pub struct NotificationCenter { /* private fields */ }Expand description
The list of notifications a window has accumulated.
Implementations§
Source§impl NotificationCenter
impl NotificationCenter
pub fn new(ident: impl Into<Ident>, cx: &mut Context<'_, Self>) -> Self
Sourcepub fn capacity(self, capacity: usize) -> Self
pub fn capacity(self, capacity: usize) -> Self
How many records the centre holds before it drops the oldest. A capacity below one is raised to one.
Sourcepub fn show(
&mut self,
notification: Notification,
cx: &mut Context<'_, Self>,
) -> bool
pub fn show( &mut self, notification: Notification, cx: &mut Context<'_, Self>, ) -> bool
Files a notification and shows a toast of it, reporting whether the toast was delivered.
False means no ToastLayer is mounted,
so nothing floated on screen — but the record is filed either way,
which is exactly the point of the centre.
Sourcepub fn record(&mut self, notification: Notification, cx: &mut Context<'_, Self>)
pub fn record(&mut self, notification: Notification, cx: &mut Context<'_, Self>)
Files a notification without showing a toast of it.
A repeat of an id already held replaces it, the way a repeated toast refreshes rather than stacking: one identity is one notification.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_read(&self, id: &str) -> Option<bool>
pub fn is_read(&self, id: &str) -> Option<bool>
Whether one notification has been read, or None when it is not here.
pub fn unread(&self) -> UnreadCount
pub fn mark_read(&mut self, id: &str, cx: &mut Context<'_, Self>) -> bool
pub fn mark_all_read(&mut self, cx: &mut Context<'_, Self>)
Trait Implementations§
Source§impl Debug for NotificationCenter
impl Debug for NotificationCenter
impl EventEmitter<NotificationCenterEvent> for NotificationCenter
Source§impl Focusable for NotificationCenter
impl Focusable for NotificationCenter
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for NotificationCenter
impl Render for NotificationCenter
Auto Trait Implementations§
impl !RefUnwindSafe for NotificationCenter
impl !Send for NotificationCenter
impl !Sync for NotificationCenter
impl !UnwindSafe for NotificationCenter
impl Freeze for NotificationCenter
impl Unpin for NotificationCenter
impl UnsafeUnpin for NotificationCenter
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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