Struct SaveStatusSurface
pub struct SaveStatusSurface { /* private fields */ }Expand description
A document’s save status, in the window’s bar (see the module).
Implementations§
§impl SaveStatusSurface
impl SaveStatusSurface
pub fn new() -> SaveStatusSurface
pub fn set(&mut self, state: SaveState, now: Instant) -> bool
pub fn set(&mut self, state: SaveState, now: Instant) -> bool
Report the save state. A change says it; the same state again does nothing, so calling this every frame is fine. Returns whether what the surface says changed.
pub fn state(&self) -> Option<&SaveState>
pub fn state(&self) -> Option<&SaveState>
The save state last reported, for an app’s accessibility status and automation.
pub fn advance(&mut self, now: Instant) -> bool
pub fn advance(&mut self, now: Instant) -> bool
Move an unconfirmed save along at now: “Retrying…” (asking for a
submission) past SAVE_STALL, “Not saved” past SAVE_GIVE_UP,
and let a passing notice go once its time is up. Returns whether
what the surface says changed.
pub fn seen(&mut self)
pub fn seen(&mut self)
The window was seen (it drew a frame): a save that gave up is said in place, and a notification about it would only repeat it.
pub fn take_retry(&mut self) -> bool
pub fn take_retry(&mut self) -> bool
Whether the surface asked for the record’s changes to be submitted
again (a save that stalled), once. A host routes it like
SaveAction::Retry.
pub fn take_bar_action(&mut self) -> Option<SaveAction>
pub fn take_bar_action(&mut self) -> Option<SaveAction>
“Try again” pressed beside the save’s notice in the window’s bar, once: the host submits the changes again. A save that gave up waits afresh.
pub fn take_notice(
&mut self,
now: Instant,
document: Option<&str>,
app: &str,
) -> Option<SaveNotice>
pub fn take_notice( &mut self, now: Instant, document: Option<&str>, app: &str, ) -> Option<SaveNotice>
A notification to raise about a save that gave up while nobody saw
the window, once, at now. It names the document (its title, if
it has one) and says the changes are still in app, since whoever
reads it is somewhere else. The host posts it and routes its action
to Self::retry_from_notice; Self::take_withdrawal says when
to take it down.
pub fn take_withdrawal(&mut self) -> bool
pub fn take_withdrawal(&mut self) -> bool
Whether a notification Self::take_notice raised should come
down (the save landed or failed differently, the person tried again,
or the window is in view again and says it in place), once.
pub fn retry_from_notice(&mut self)
pub fn retry_from_notice(&mut self)
“Try again” from the notification Self::take_notice raised: the
host submits the changes again and the wait starts over.
pub fn shows_unsaved(&self) -> bool
pub fn shows_unsaved(&self) -> bool
Whether the document has work the window should mark unsaved
(crate::window_toolbar::ToolbarLocation::edited): a save that
failed, or one still unconfirmed past SAVE_STALL. A save that
lands in time marks nothing, as it says nothing.
pub fn notice(&self) -> Option<ToolbarNotice>
pub fn notice(&self) -> Option<ToolbarNotice>
What the window’s bar says of the save, if anything: a failure or a save that gave up, held with “Try again”, or a passing “Saved” or “Retrying…”.
pub fn publish(&self)
pub fn publish(&self)
Keep the window’s bar saying the save’s notice while there is one, and take it down once there is not; call on every sync. A notice shown since from elsewhere in the window stays.
pub fn needs_publish(&self) -> bool
pub fn needs_publish(&self) -> bool
Whether the window’s bar says something other than the save’s notice
now: a passing notice whose time is over is still up until the next
Self::publish. A widget whose sync runs only on a reported
change reports one while this holds.
pub fn next_wake_deadline(&self) -> Option<Instant>
pub fn next_wake_deadline(&self) -> Option<Instant>
When the surface next moves along by itself: a passing notice’s end, or an unconfirmed save’s next stage. A held notice waits for the person.
Trait Implementations§
§impl Debug for SaveStatusSurface
impl Debug for SaveStatusSurface
§impl Default for SaveStatusSurface
impl Default for SaveStatusSurface
§fn default() -> SaveStatusSurface
fn default() -> SaveStatusSurface
§impl Drop for SaveStatusSurface
A save status gone with its window leaves the window’s bar with it.
impl Drop for SaveStatusSurface
A save status gone with its window leaves the window’s bar with it.
Auto Trait Implementations§
impl !Freeze for SaveStatusSurface
impl !RefUnwindSafe for SaveStatusSurface
impl Send for SaveStatusSurface
impl !Sync for SaveStatusSurface
impl Unpin for SaveStatusSurface
impl UnsafeUnpin for SaveStatusSurface
impl UnwindSafe for SaveStatusSurface
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
§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