pub enum NotificationLevel {
Info,
Success,
Warn,
Error,
}Expand description
How loudly a notification reads, and how long it lingers.
Deliberately the same three levels EchoLevel already carries —
two vocabularies for “how bad is this” would drift, and a consumer
mapping between them is a bug waiting to happen.
Variants§
Info
Success
Work the user started finished cleanly.
A state, not a severity. It is Info in every respect that
measures how bad something is — timeout, the *messages* tee —
and differs only in how it reads: a green check, so a finished
push is distinguishable at a glance from a neutral note. The
“same three levels as EchoLevel” rule is about severity, and
this adds none.
Warn
Error
Implementations§
Source§impl NotificationLevel
impl NotificationLevel
Sourcepub fn default_timeout(self) -> Duration
pub fn default_timeout(self) -> Duration
How long a notification of this level stays up by default.
Errors linger and warnings linger a little. An error you
blink past is an error you will hit again; the whole point of
the subsystem is that a failed fetch stops being invisible. The
numbers are defaults — a caller may override, and
notifications.default-timeout will govern them once config
lands.
Sourcepub fn timeout_multiplier(self) -> u64
pub fn timeout_multiplier(self) -> u64
How much longer than an info notification this level lasts.
One knob times a fixed ratio rather than three independent options: raising the base must not leave errors relatively SHORTER than the successes around them, and three knobs make that misconfiguration reachable.
pub fn label(self) -> &'static str
Sourcepub fn glyph(self, nerd_fonts: bool) -> &'static str
pub fn glyph(self, nerd_fonts: bool) -> &'static str
The icon that leads this level’s row, for the current palette.
One function both renderers and the *notifications* buffer
call, so the three surfaces cannot drift apart. Nerd Fonts v3
glyphs when ui.nerd_fonts is on; otherwise a BMP fallback that
renders in every monospace font — the same shapes the diagnostic
gutter falls back to (● ▲), so “warning” looks the same
everywhere. Both palettes are one cell wide, so toggling the
option cannot shift the text that follows.
Trait Implementations§
Source§impl Clone for NotificationLevel
impl Clone for NotificationLevel
Source§fn clone(&self) -> NotificationLevel
fn clone(&self) -> NotificationLevel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NotificationLevel
Source§impl Debug for NotificationLevel
impl Debug for NotificationLevel
Source§impl Default for NotificationLevel
impl Default for NotificationLevel
Source§fn default() -> NotificationLevel
fn default() -> NotificationLevel
impl Eq for NotificationLevel
Source§impl PartialEq for NotificationLevel
impl PartialEq for NotificationLevel
impl StructuralPartialEq for NotificationLevel
Auto Trait Implementations§
impl Freeze for NotificationLevel
impl RefUnwindSafe for NotificationLevel
impl Send for NotificationLevel
impl Sync for NotificationLevel
impl Unpin for NotificationLevel
impl UnsafeUnpin for NotificationLevel
impl UnwindSafe for NotificationLevel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.