pub const fn notice_lifetime(transient: bool) -> Option<Duration>Expand description
How long a notice lives, given whether the description calls it transient.
The seam this crate was built for. makeover-layout documents
Notice::Toast as “transient, stacked, dismisses itself” and
Notice::transient() returns true for it — the description says a notice
goes away on its own and deliberately says nothing about when. This is
when, on the renderer’s side of the line:
// notice_lifetime(makeover_layout::Notice::Toast.transient())
assert_eq!(notice_lifetime(true), Some(Intent::Dismiss.duration()));
assert_eq!(notice_lifetime(false), None);Taking the bool rather than the enum is what keeps this crate off
makeover-layout’s dependency graph, and the bool is exactly what the
description asserts. A renderer already holds the Notice.
None is not “the caller decides”. It means the notice has no lifetime:
a banner is dismissed by fixing the cause, and an error is a banner. See
the crate header on why severity is not a fifth duration.