Skip to main content

MockNotifications

Struct MockNotifications 

Source
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

Source

pub fn new() -> MockNotifications

Source

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.

Source

pub fn without_replies(self) -> MockNotifications

A system without typed replies.

Source

pub fn without_scheduling(self) -> MockNotifications

A system without delivery at a later time.

Source

pub fn shown(&self) -> Vec<Notification>

The notifications showing, oldest first; a replaced one is where it first showed.

Source

pub fn scheduled(&self) -> Vec<(Notification, SystemTime)>

The notifications waiting for their time, with it.

Source

pub fn times_asked(&self) -> u32

How many times the user was asked.

Trait Implementations§

Source§

impl Clone for MockNotifications

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MockNotifications

Source§

fn default() -> MockNotifications

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

impl NotificationPermission for MockNotifications

Source§

fn state(&self) -> PermissionFuture

The permission as it stands, without asking.
Source§

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

Source§

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

Source§

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

Source§

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 remove(&self, id: &str)

Takes away the notification posted or scheduled under id.
Source§

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>

A typed reply, where the system takes one.
Source§

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 MockNotifications
where *const RcInner<NotificationsState> is !null: Freeze, PhantomData<RcInner<NotificationsState>>: Freeze,

§

impl Move for MockNotifications

§

impl Unpin for MockNotifications
where Rc<NotificationsState>: Unpin,

§

impl UnsafeUnpin for MockNotifications
where *const RcInner<NotificationsState> is !null: UnsafeUnpin, PhantomData<RcInner<NotificationsState>>: UnsafeUnpin,

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Upcast<T> for T

Source§

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