pub struct MockNotifications(/* private fields */);Expand description
Notifications that keep what the app posted, scheduled and removed. By default any app may notify, as on a system with no permission question, and replies and scheduling are there. Every clone is the same notifications.
Implementations§
Source§impl MockNotifications
impl MockNotifications
pub fn new() -> MockNotifications
Sourcepub fn asking(
self,
state: PermissionState,
answer: PermissionState,
) -> MockNotifications
pub fn asking( self, state: PermissionState, answer: PermissionState, ) -> MockNotifications
A system with a question of its own, where the permission stands at state, and the user
answers answer when the app asks (NotificationPermission::request); a post never asks,
and is denied until the permission is granted.
Sourcepub fn without_replies(self) -> MockNotifications
pub fn without_replies(self) -> MockNotifications
A system without typed replies.
Sourcepub fn without_scheduling(self) -> MockNotifications
pub fn without_scheduling(self) -> MockNotifications
A system without delivery at a later time.
Sourcepub fn shown(&self) -> Vec<Notification>
pub fn shown(&self) -> Vec<Notification>
The notifications showing, oldest first; a replaced one is where it first showed.
Sourcepub fn scheduled(&self) -> Vec<(Notification, SystemTime)>
pub fn scheduled(&self) -> Vec<(Notification, SystemTime)>
The notifications waiting for their time, with it.
Sourcepub fn times_asked(&self) -> u32
pub fn times_asked(&self) -> u32
How many times the user was asked.
Trait Implementations§
Source§impl Clone for MockNotifications
impl Clone for MockNotifications
Source§impl Default for MockNotifications
impl Default for MockNotifications
Source§fn default() -> MockNotifications
fn default() -> MockNotifications
Returns the “default value” for a type. Read more
Source§impl NotificationPermission for MockNotifications
impl NotificationPermission for MockNotifications
Source§fn state(&self) -> PermissionFuture
fn state(&self) -> PermissionFuture
The permission as it stands, without asking.
Source§fn request(&self) -> PermissionFuture
fn request(&self) -> PermissionFuture
Asks the user where they have not been asked, with the system’s own question; answers the
permission after. Where they answered before, or the system has no question, it asks
nothing and answers the permission as it stands.
Source§impl NotificationReplies for MockNotifications
impl NotificationReplies for MockNotifications
Source§fn reply_action(
&self,
id: &str,
label: &str,
placeholder: &str,
) -> NotificationAction
fn reply_action( &self, id: &str, label: &str, placeholder: &str, ) -> NotificationAction
An action that asks for a reply, shown as a field with
placeholder in it.Source§impl NotificationScheduling for MockNotifications
impl NotificationScheduling for MockNotifications
Source§fn schedule(&self, notification: &Notification, at: SystemTime) -> PostFuture
fn schedule(&self, notification: &Notification, at: SystemTime) -> PostFuture
Shows
notification at at, or at once where at has passed; a later post or schedule
under its id replaces it, and Notifications::remove cancels it. It never asks the user,
as a post does not.Source§impl Notifications for MockNotifications
impl Notifications for MockNotifications
Source§fn post(&self, notification: &Notification) -> PostFuture
fn post(&self, notification: &Notification) -> PostFuture
Shows
notification, in place of the one posted under its id while that is still there.
It never asks the user and never reads the permission first: it answers
NotificationError::Denied where the system refuses the post itself, and otherwise the
system decides whether it shows. Whether the app may notify, and asking, is
Notifications::permission’s.Source§fn permission(&self) -> Option<&dyn NotificationPermission>
fn permission(&self) -> Option<&dyn NotificationPermission>
The user’s permission, where the system keeps one for the app;
None where any app may
notify.Source§fn replies(&self) -> Option<&dyn NotificationReplies>
fn replies(&self) -> Option<&dyn NotificationReplies>
A typed reply, where the system takes one.
Source§fn scheduling(&self) -> Option<&dyn NotificationScheduling>
fn scheduling(&self) -> Option<&dyn NotificationScheduling>
Delivery at a later time, held by the system whether or not the app runs.
Auto Trait Implementations§
impl !RefUnwindSafe for MockNotifications
impl !Send for MockNotifications
impl !Sync for MockNotifications
impl !UnwindSafe for MockNotifications
impl Forget for MockNotifications
impl Freeze for MockNotificationswhere
*const RcInner<NotificationsState> is !null: Freeze,
PhantomData<RcInner<NotificationsState>>: Freeze,
impl Move for MockNotifications
impl Unpin for MockNotifications
impl UnsafeUnpin for MockNotificationswhere
*const RcInner<NotificationsState> is !null: UnsafeUnpin,
PhantomData<RcInner<NotificationsState>>: UnsafeUnpin,
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