#[non_exhaustive]pub struct Notice {Show 14 fields
pub v: u32,
pub id: NoticeId,
pub at_ms: u64,
pub severity: Severity,
pub kind: Kind,
pub origin: Origin,
pub headline: String,
pub reason: Option<String>,
pub hint: Option<String>,
pub details: Option<String>,
pub actions: Vec<NoticeAction>,
pub subject: Option<String>,
pub place: Option<String>,
pub node: Option<String>,
}Expand description
One message for people: see the module.
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.v: u32The version of its JSON shape (VERSION).
id: NoticeIdIts id; empty until it is raised (the store gives one).
at_ms: u64When it happened, in milliseconds since 1970 (UTC); 0 until it is raised (raising it sets now).
severity: Severity§kind: Kind§origin: Origin§headline: StringWhat happened, in the user’s words: “cloudy was not added”.
reason: Option<String>Why, in the user’s words, when known.
hint: Option<String>What the user can do about it.
details: Option<String>The technical chain (an error’s sources), copyable.
actions: Vec<NoticeAction>Its buttons, in order.
subject: Option<String>What it is about (a photo, a job, a node: node:cloudy).
place: Option<String>Where it happened in the interface (a window, a panel, a page:
settings/storage/nodes).
node: Option<String>The node it happened on, for a notice from another node.
Implementations§
Source§impl Notice
impl Notice
pub fn new(severity: Severity, headline: impl Into<String>) -> Self
pub fn info(headline: impl Into<String>) -> Self
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 id(self, id: impl Into<NoticeId>) -> Self
pub fn id(self, id: impl Into<NoticeId>) -> Self
Its id (by default the store gives one when it is raised).
Sourcepub fn at_ms(self, at_ms: u64) -> Self
pub fn at_ms(self, at_ms: u64) -> Self
When it happened, in milliseconds since 1970 (by default, when it is raised).
pub fn kind(self, kind: Kind) -> Self
pub fn origin(self, origin: Origin) -> Self
Sourcepub fn details(self, details: impl Into<String>) -> Self
pub fn details(self, details: impl Into<String>) -> Self
The technical chain (left out when blank).
Sourcepub fn details_from(self, err: &(dyn Error + 'static)) -> Self
pub fn details_from(self, err: &(dyn Error + 'static)) -> Self
The chain of an error and its sources, one per line.
Sourcepub fn action(self, id: impl Into<String>, label: impl Into<String>) -> Self
pub fn action(self, id: impl Into<String>, label: impl Into<String>) -> Self
A button, after the others.
Sourcepub fn action_with(
self,
id: impl Into<String>,
label: impl Into<String>,
args: Value,
) -> Self
pub fn action_with( self, id: impl Into<String>, label: impl Into<String>, args: Value, ) -> Self
A button whose command runs with args, after the others: “Undo
this restore” ({"restore": 7}). The arguments are kept with the
notice, saved with it, and given to the command when the button
runs it, from a toast, a notice site or the Notices panel.
pub fn subject(self, subject: impl Into<String>) -> Self
pub fn place(self, place: impl Into<String>) -> Self
Sourcepub fn node(self, node: impl Into<String>) -> Self
pub fn node(self, node: impl Into<String>) -> Self
The node it happened on; its origin becomes Origin::Node.