pub struct ToastStore { /* private fields */ }Expand description
Entity holding the active toasts — v3’s ToastQueue.
Implementations§
Source§impl ToastStore
impl ToastStore
Sourcepub fn subscribe(
store: &Entity<Self>,
cx: &mut App,
f: impl FnMut(&mut App) + 'static,
) -> Subscription
pub fn subscribe( store: &Entity<Self>, cx: &mut App, f: impl FnMut(&mut App) + 'static, ) -> Subscription
ToastQueue.subscribe — run f whenever the queue changes.
v3 returns an unsubscribe function; gpui returns a Subscription whose
drop does the same, so the caller keeps it for as long as it wants the
callback.
Sourcepub fn visible_toasts(&self, max_visible: usize) -> &[ToastData]
pub fn visible_toasts(&self, max_visible: usize) -> &[ToastData]
The newest toasts currently exposed by maxVisibleToasts; overflow
remains queued until a visible toast closes.
Sourcepub fn resume_all(&mut self)
pub fn resume_all(&mut self)
resumeAll — start them again.
Sourcepub fn timers_paused(&self) -> bool
pub fn timers_paused(&self) -> bool
True while the region is hovered or focus-within, or pauseAll is on.
Sourcepub fn is_interaction_paused(&self) -> bool
pub fn is_interaction_paused(&self) -> bool
Whether timers are paused by hover or focus within the region.
Sourcepub fn is_expanded(&self) -> bool
pub fn is_expanded(&self) -> bool
The last data-expanded the viewport painted.
Overflow past maxVisibleToasts — still queued, marked data-hidden.
Sourcepub fn add(store: &Entity<Self>, data: ToastData, cx: &mut App) -> u64
pub fn add(store: &Entity<Self>, data: ToastData, cx: &mut App) -> u64
add — queue a toast, notify subscribers, and return its id.
Sourcepub fn close(store: &Entity<Self>, id: u64, cx: &mut App)
pub fn close(store: &Entity<Self>, id: u64, cx: &mut App)
close — drop one toast by id and report its onClose once.
The card leaves Self::toasts immediately. Unless reduced motion is
on or exitDuration is zero, it stays in Self::exiting for the
configured fade so [data-exiting] can paint. onClose still fires
at the start of that exit, matching the pinned queue.
Auto Trait Implementations§
impl !RefUnwindSafe for ToastStore
impl !Send for ToastStore
impl !Sync for ToastStore
impl !UnwindSafe for ToastStore
impl Freeze for ToastStore
impl Unpin for ToastStore
impl UnsafeUnpin for ToastStore
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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