Struct SaveStatusSurface
pub struct SaveStatusSurface { /* private fields */ }Expand description
A document’s save status, on the framework’s status surfaces (HIG §7c):
“Saving…” and “Saved” are a change worth noticing once, so they show in
the transient StatusBubble; a failed save is an error the person must
act on, so it is an error toast (danger icon, the reason, a “Try again”
action and a close button) that stays until the save succeeds or it is
dismissed. An app reports the state and routes clicks; it never pins a
bubble open or paints its own save pill.
Both float in the bottom-trailing corner of the area they report on, clear of its scroll bar gutter.
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 shows it; the same state again does nothing, so calling this every frame is fine. Returns whether what is shown changed.
pub fn set_detail(&mut self, detail: Option<String>)
pub fn set_detail(&mut self, detail: Option<String>)
Say something about the saved document after “Saved” (a note’s length). It reads current while the bubble shows and never reopens it on its own.
pub fn poke(&mut self, now: Instant) -> bool
pub fn poke(&mut self, now: Instant) -> bool
Show the bubble again (another document opened under it). A showing failure needs no reminder.
pub fn hover_bubble(
&mut self,
area: Rect,
p: Point,
tr: &mut TextRenderer,
theme: &Theme,
now: Instant,
) -> bool
pub fn hover_bubble( &mut self, area: Rect, p: Point, tr: &mut TextRenderer, theme: &Theme, now: Instant, ) -> bool
The pointer moved to p over area: resting on the bubble’s corner
pins it open (see StatusBubble::pointer_moved). Returns whether
visibility changed.
pub fn accessibility(&self, target: &str) -> Option<AccessNode>
pub fn accessibility(&self, target: &str) -> Option<AccessNode>
The surface for assistive technology while a failure shows: the
reason, announced, with “Try again” and “Dismiss” buttons whose
action targets are {target}.retry and {target}.dismiss.
pub fn perform(
&mut self,
target: &str,
action_target: &str,
) -> Option<SaveAction>
pub fn perform( &mut self, target: &str, action_target: &str, ) -> Option<SaveAction>
Assistive technology activated action_target (one of
Self::accessibility’s buttons under target): the action it is.
pub fn is_visible(&self, now: Instant) -> bool
pub fn is_visible(&self, now: Instant) -> bool
Whether anything is showing at now.
pub fn needs_frame(&self, now: Instant) -> bool
pub fn needs_frame(&self, now: Instant) -> bool
Frames are needed only while the bubble lingers or fades.
pub fn next_wake_deadline(&self) -> Option<Instant>
pub fn next_wake_deadline(&self) -> Option<Instant>
Wake once to remove a transient, including when reduced motion disables fades. Keep an overdue deadline until paint consumes it, so a parked host sees it.
pub fn pointer_moved(&mut self, p: Point) -> bool
pub fn pointer_moved(&mut self, p: Point) -> bool
The pointer moved to p; returns whether the hover changed.
pub fn click(&mut self, p: Point) -> Option<SaveAction>
pub fn click(&mut self, p: Point) -> Option<SaveAction>
A click at p: the action it hits on a showing failure. Dismissing
hides the failure until the state changes again.
Trait Implementations§
§impl Clone for SaveStatusSurface
impl Clone for SaveStatusSurface
§fn clone(&self) -> SaveStatusSurface
fn clone(&self) -> SaveStatusSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for SaveStatusSurface
impl Debug for SaveStatusSurface
§impl Default for SaveStatusSurface
impl Default for SaveStatusSurface
§fn default() -> SaveStatusSurface
fn default() -> SaveStatusSurface
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
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> DowncastSync for T
impl<T> DowncastSync 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