Skip to main content

Utils

Struct Utils 

Source
pub struct Utils<'a, R: Runtime> { /* private fields */ }
Expand description

API of utils.

Implementations§

Source§

impl<'a, R: Runtime> AsyncUtils<'a, R>

Source

pub async fn create_progress_notification( &self, icon: ProgressNotificationIcon, title: Option<&str>, text: Option<&str>, sub_text: Option<&str>, progress: Option<u64>, progress_max: Option<u64>, ) -> Result<ProgressNotificationGuard<R>>

Displays a notification indicating progress on status bar.

The returned ProgressNotificationGuard can be used to manage the notification.

By default, ProgressNotificationGuard finishes the notification as a “failure” when dropped.
You can change the drop behavior by using ProgressNotificationGuard::set_drop_behavior_to_complete or ProgressNotificationGuard::set_drop_behavior_to_fail.

§Note

This needs two steps:

  1. Declare :
    By enabling the notification_permission feature,
    you can declare the permissions automatically at build time.

  2. Runtime request :
    By calling Utils::request_notification_permission, you can request the permissions from the user at runtime.

§Support

All Android version.

Source

pub async fn request_notification_permission(&self) -> Result<bool>

§Note

To request the permissions, you must declare POST_NOTIFICATIONS in AndroidManifest.xml. By enabling the notification_permission feature, the permissions will be declared automatically.

Source

pub async fn check_notification_permission(&self) -> Result<bool>

Auto Trait Implementations§

§

impl<'a, R> Freeze for AsyncUtils<'a, R>

§

impl<'a, R> RefUnwindSafe for AsyncUtils<'a, R>

§

impl<'a, R> Send for AsyncUtils<'a, R>

§

impl<'a, R> Sync for AsyncUtils<'a, R>

§

impl<'a, R> Unpin for AsyncUtils<'a, R>

§

impl<'a, R> UnsafeUnpin for AsyncUtils<'a, R>

§

impl<'a, R> UnwindSafe for AsyncUtils<'a, R>

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> ErasedDestructor for T
where T: 'static,