Skip to main content

notice_lifetime

Function notice_lifetime 

Source
pub const fn notice_lifetime(persistence: Persistence) -> Option<Duration>
Expand description

How long a notice lives, given whether it goes away on its own.

makeover-layout documents Notice::Toast as “transient, stacked, dismisses itself” and says nothing about when. This is when:

assert_eq!(
    notice_lifetime(Persistence::Transient),
    Some(Moment::Dismiss.duration())
);
assert_eq!(notice_lifetime(Persistence::Standing), None);

None means the notice has no lifetime: it stays until its cause is fixed. It does not mean “the caller decides”.