#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.severity: Severity§headline: StringWhat 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: boolThe Copy button (on by default).
announce: boolAnnounced when it appears or changes (on by default).
compact: boolOne line after its symbol, nothing else (Note::compact).
Implementations§
Source§impl Note
impl Note
pub fn new(severity: Severity, headline: impl Into<String>) -> Self
pub fn info(headline: impl Into<String>) -> Self
Sourcepub fn from_notice(notice: &Notice) -> Self
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.
pub fn success(headline: impl Into<String>) -> Self
pub fn warning(headline: impl Into<String>) -> Self
pub fn error(headline: impl Into<String>) -> Self
Sourcepub fn reason(self, reason: impl Into<String>) -> Self
pub fn reason(self, reason: impl Into<String>) -> Self
Why, in plain words (left out when blank).
Sourcepub fn hint(self, hint: impl Into<String>) -> Self
pub fn hint(self, hint: impl Into<String>) -> Self
What the user can do about it (left out when blank).
Sourcepub fn details(self, details: impl Into<String>) -> Self
pub fn details(self, details: impl Into<String>) -> Self
The technical chain, folded under “Details” (left out when blank).
Sourcepub fn time(self, time: impl Into<String>) -> Self
pub fn time(self, time: impl Into<String>) -> Self
When it happened, as the Copy button writes it.
Sourcepub fn action(self, label: impl Into<String>) -> Self
pub fn action(self, label: impl Into<String>) -> Self
A button, after the others; NoteResponse::action says which
one was clicked.
Sourcepub fn announced(self, announce: bool) -> Self
pub fn announced(self, announce: bool) -> Self
Announced to screen readers when it appears or changes, or not.
Sourcepub fn compact(self) -> Self
pub fn compact(self) -> Self
One line of text after its symbol: no frame, no Copy button, no details, no announcement.
Sourcepub fn id_salt(self, salt: impl AsIdSalt) -> Self
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.
Sourcepub fn copy_text(&self) -> String
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: …).
Sourcepub fn show(self, ui: &mut Ui) -> NoteResponse
pub fn show(self, ui: &mut Ui) -> NoteResponse
Draws it, as wide as the room left.
Sourcepub fn show_with(self, ui: &mut Ui, extra: impl FnOnce(&mut Ui)) -> NoteResponse
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§
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> 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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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