Struct Transient
pub struct Transient<T> { /* private fields */ }Expand description
A message an app shows over its content for a while. It is one of two kinds:
- plain information (a confirmation, a status, a failure,
Self::show) stops reporting once it has been up forNOTICE_LIFETIME, so a message nobody takes down still leaves; showing one again starts its time over; - progress (work under way, “Opening book.epub”,
Self::show_progress) stays while the app reports the work as still running (Self::keep_while) and leaves once it no longer does, or aNOTICE_LIFETIMEafter it last did, so no stale progress stays.
The message shows in the window’s bar (Self::publish, on every sync):
the app asks to be woken at Self::deadline and, there, renews
progress and calls Self::expire. A message that needs the person to
act before it goes is not a transient one.
Implementations§
§impl<T> Transient<T>
impl<T> Transient<T>
pub const fn new() -> Transient<T>
pub fn publish(&self, notice: impl FnOnce(&T) -> ToolbarNotice)
pub fn publish(&self, notice: impl FnOnce(&T) -> ToolbarNotice)
Show the message in the window’s bar while it lasts, as notice
says it, and take it down once it has gone; call on every sync. A
notice shown since from elsewhere in the window stays: the newest
replaces the older.
pub fn showing_progress(value: T) -> Transient<T>
pub fn showing_progress(value: T) -> Transient<T>
value, shown from now as progress of work under way.
pub fn show(&mut self, value: T)
pub fn show(&mut self, value: T)
Show value as plain information, replacing anything already up,
for a full lifetime.
pub fn show_progress(&mut self, value: T)
pub fn show_progress(&mut self, value: T)
Show value as progress of work under way, replacing anything
already up: it stays while Self::keep_while reports the work
running.
pub fn keep_while(&mut self, busy: bool) -> bool
pub fn keep_while(&mut self, busy: bool) -> bool
Report whether the work a progress message follows is still running, on every sync: while it is the message stays, once it is not the message goes. Plain information keeps its own time. Whether a message went.
pub fn is_progress(&self) -> bool
pub fn is_progress(&self) -> bool
Whether the message up is progress of work under way.
pub fn as_deref(&self) -> Option<&<T as Deref>::Target>where
T: Deref,
pub fn as_deref(&self) -> Option<&<T as Deref>::Target>where
T: Deref,
The message borrowed through its Deref (a String as a &str).
pub fn is_shown(&self) -> bool
pub fn since(&self) -> Option<Instant>
pub fn since(&self) -> Option<Instant>
When the message’s time started, while it is up: when it went up, or, for progress, when the work was last reported running.
pub fn deadline(&self) -> Option<Instant>
pub fn deadline(&self) -> Option<Instant>
When the message leaves (progress: when it must next be renewed),
for a widget’s next_wake_deadline. It stays due while the window’s
bar still shows the message, so the frame that takes it down runs at
that time without further input; once a sync has published
its leaving there is none, so the widget is not woken over and over.
Under the capture clock nothing leaves.
Trait Implementations§
§impl<T> Clone for Transient<T>where
T: Clone,
A copy keeps the message but not the bar’s notice: the original took it
up and takes it down.
impl<T> Clone for Transient<T>where
T: Clone,
A copy keeps the message but not the bar’s notice: the original took it up and takes it down.
Auto Trait Implementations§
impl<T> !Freeze for Transient<T>
impl<T> !RefUnwindSafe for Transient<T>
impl<T> Send for Transient<T>where
T: Send,
impl<T> !Sync for Transient<T>
impl<T> Unpin for Transient<T>where
T: Unpin,
impl<T> UnsafeUnpin for Transient<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Transient<T>where
T: UnwindSafe,
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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