Skip to main content

SaveStatusSurface

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

pub fn new() -> SaveStatusSurface

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>

The save state last reported, for an app’s accessibility status and automation.

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)

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

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>

“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>

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

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)

“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

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 gave_up(&self) -> bool

Whether the current save gave up waiting and asks the person.

pub fn failure(&self) -> Option<&str>

The reason of the failure that stands, if any.

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)

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

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>

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

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for SaveStatusSurface

§

fn default() -> SaveStatusSurface

Returns the “default value” for a type. Read more
§

impl Drop for SaveStatusSurface

A save status gone with its window leaves the window’s bar with it.

§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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 T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> WasmNotSend for T
where T: Send,