Skip to main content

NotificationLevel

Enum NotificationLevel 

Source
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

Source

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.

Source

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.

Source

pub fn label(self) -> &'static str

Source

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

Source§

fn clone(&self) -> NotificationLevel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NotificationLevel

Source§

impl Debug for NotificationLevel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NotificationLevel

Source§

fn default() -> NotificationLevel

Returns the “default value” for a type. Read more
Source§

impl Eq for NotificationLevel

Source§

impl PartialEq for NotificationLevel

Source§

fn eq(&self, other: &NotificationLevel) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NotificationLevel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more