Skip to main content

Note

Struct Note 

Source
#[non_exhaustive]
pub struct Note { pub severity: Severity, pub headline: String, pub reason: Option<String>, pub hint: Option<String>, pub details: Option<String>, pub time: Option<String>, pub actions: Vec<String>, pub copy: bool, pub announce: bool, pub compact: bool, /* private fields */ }
Expand description

An inline message in sentences: see the module.

Need (help): an inline message (an error, a warning, a success) in sentences, selectable and copyable.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§severity: Severity§headline: String

What happened, in plain words.

§reason: Option<String>

Why, in plain words.

§hint: Option<String>

What the user can do about it.

§details: Option<String>

The technical chain (an error’s sources), folded at first.

§time: Option<String>

When it happened, as copied; when not given, the time the note was first shown.

§actions: Vec<String>

The labels of its buttons, in order.

§copy: bool

The Copy button (on by default).

§announce: bool

Announced when it appears or changes (on by default).

§compact: bool

One line after its symbol, nothing else (Note::compact).

Implementations§

Source§

impl Note

Source

pub fn new(severity: Severity, headline: impl Into<String>) -> Self

Source

pub fn info(headline: impl Into<String>) -> Self

Source

pub fn from_notice(notice: &Notice) -> Self

The note of a notice (egui_pop_model::notice::Notice): its severity, headline, reason, hint, details, time (when it has one) and its actions’ labels, in order; its id keeps the note’s state (folded details, announcement) while its text changes.

Source

pub fn success(headline: impl Into<String>) -> Self

Source

pub fn warning(headline: impl Into<String>) -> Self

Source

pub fn error(headline: impl Into<String>) -> Self

Source

pub fn reason(self, reason: impl Into<String>) -> Self

Why, in plain words (left out when blank).

Source

pub fn hint(self, hint: impl Into<String>) -> Self

What the user can do about it (left out when blank).

Source

pub fn details(self, details: impl Into<String>) -> Self

The technical chain, folded under “Details” (left out when blank).

Source

pub fn time(self, time: impl Into<String>) -> Self

When it happened, as the Copy button writes it.

Source

pub fn action(self, label: impl Into<String>) -> Self

A button, after the others; NoteResponse::action says which one was clicked.

Source

pub fn copyable(self, copy: bool) -> Self

With or without the Copy button.

Source

pub fn announced(self, announce: bool) -> Self

Announced to screen readers when it appears or changes, or not.

Source

pub fn compact(self) -> Self

One line of text after its symbol: no frame, no Copy button, no details, no announcement.

Source

pub fn id_salt(self, salt: impl AsIdSalt) -> Self

Its id among its siblings (by default its severity and headline): give one to keep its folded details and its announcement when its text changes.

Source

pub fn copy_text(&self) -> String

What its Copy button puts on the clipboard: the headline, the reason and the hint, each a paragraph, then under a --- line the details and the time (time: …).

Source

pub fn show(self, ui: &mut Ui) -> NoteResponse

Draws it, as wide as the room left.

Source

pub fn show_with(self, ui: &mut Ui, extra: impl FnOnce(&mut Ui)) -> NoteResponse

Draws it with widgets of the caller’s after its actions (a button running a command, for instance).

Trait Implementations§

Source§

impl Clone for Note

Source§

fn clone(&self) -> Note

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Note

Source§

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

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

impl PartialEq for Note

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Note

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Send for Note

§

impl Sync for Note

§

impl Unpin for Note

§

impl UnsafeUnpin for Note

§

impl UnwindSafe for Note

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,