Skip to main content

ModuleCx

Struct ModuleCx 

Source
pub struct ModuleCx { /* private fields */ }
Expand description

The context of a module function that is not async: the platform’s services, applied in order right after the call (an async one uses the free functions, dialog(..), …).

Implementations§

Source§

impl ModuleCx

Source

pub fn dialog(&mut self, dialog: AlertDialogRequest) -> DialogAnswer

Shows dialog; await the answer in an async function.

Source

pub fn set_builtin_scrollbars( &mut self, source: ScrollbarSource, theme: Option<AnyValue>, )

Draws the views’ bars with the built-in bar source makes of theme, or with the platform’s indicator (set_builtin_scrollbars).

Source

pub fn run_on_main_thread<R: Send + 'static>( &mut self, f: impl FnOnce() -> R + Send + 'static, ) -> OnMainThread<R> ⓘ

Runs f on the platform’s main thread after the call, as run_on_main_thread does: spawn a task that awaits the result, or drop it.

Source

pub fn dismiss_keyboard(&mut self)

Unfocuses the focused input, hiding the software keyboard.

Source

pub fn set_status_bar(&mut self, patch: StatusBarSetting)

Changes what functions set for the status bar (the fields patch sets), under the settings components render.

Source

pub fn animate_layout(&mut self, animation: LayoutAnimation)

Animates the layout changes of the next commit.

Source

pub fn announce_for_accessibility(&mut self, message: impl Into<String>)

The screen reader reads message (TS: announce).

Source

pub fn haptic(&mut self, haptic: Haptic)

The device plays haptic (TS: Haptics of nsh/mobile).

Source

pub fn set_clipboard( &mut self, text: impl Into<String>, ) -> Answer<ClipboardWrite> ⓘ

Puts text on the system clipboard (TS: Clipboard.writeText). The answer says whether the system clipboard took it.

Source

pub fn set_clipboard_item( &mut self, item: ClipboardItem, ) -> Answer<ClipboardWrite> ⓘ

Puts item, its text and its HTML, on the system clipboard (TS: Clipboard.write). The answer says whether the system clipboard took it.

Source

pub fn set_clipboard_image(&mut self, uri: impl Into<String>)

Puts the image of a data: URI on the system clipboard (TS: Clipboard.writeImage).

Source

pub fn set_color_scheme(&mut self, appearance: Appearance)

Shows the surface in appearance whatever the system’s (TS: setColorScheme): crate::prelude::dark (the theme’s mode), dark: classes and the platform’s controls follow it; crate::platform::Appearance::System follows the system again.

Source

pub fn set_locale(&mut self, locale: Option<Locale>)

Shows the app in locale whatever the user’s language (None: the user’s again), as crate::i18n::set_locale does.

Trait Implementations§

Source§

impl Default for ModuleCx

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for ModuleCx

§

impl !Send for ModuleCx

§

impl !Sync for ModuleCx

§

impl !UnwindSafe for ModuleCx

§

impl Forget for ModuleCx

§

impl Freeze for ModuleCx
where *const u8 is !null: Freeze, PhantomData<Action>: Freeze,

§

impl Move for ModuleCx

§

impl Unpin for ModuleCx
where *const u8 is !null: Unpin, Arc<Tokens>: Unpin, Box<AlertDialogRequest>: Unpin, Arc<Drawing>: Unpin, Box<FileRequest>: Unpin, Arc<dyn AsRef<[u8]> + Sync + Send>: Unpin, Arc<Rgba>: Unpin, Box<DesktopCommand>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Arc<str>: Unpin, Rc<RefCell<Output<DialogReply>>>: Unpin, Box<dyn ToJs>: Unpin, Box<ErrorFields>: Unpin, Rc<RefCell<Output<Result<ImageSize, String>>>>: Unpin, Box<HttpRequest>: Unpin, Rc<RefCell<Output<Result<HttpResponse, FetchFailure>>>>: Unpin, Rc<RefCell<Output<String>>>: Unpin, Rc<RefCell<Output<Option<String>>>>: Unpin, Rc<RefCell<Output<bool>>>: Unpin, Rc<RefCell<Output<Option<ClipboardImage>>>>: Unpin, Rc<RefCell<Output<Result<Option<ClipboardImage>, usize>>>>: Unpin, Rc<RefCell<Output<Vec<String>>>>: Unpin, Box<dyn FnOnce() + Send>: Unpin, Rc<RefCell<Output<Result<String, String>>>>: Unpin, Rc<RefCell<Output<Vec<PickedFile>>>>: Unpin, Rc<RefCell<Output<Result<Value, HostError>>>>: Unpin, Rc<RefCell<Output<Result<bool, AppSettingsError>>>>: Unpin, Rc<RefCell<Output<ClipboardWrite>>>: Unpin, Rc<RefCell<Output<Option<Hsla>>>>: Unpin, Box<RenderRequest>: Unpin, Rc<RefCell<Output<Result<Vec<u8>, JsError>>>>: Unpin, Rc<RefCell<Output<NotificationPermission>>>: Unpin, Rc<RefCell<Output<Result<bool, LaunchAtLoginError>>>>: Unpin, Rc<RefCell<Output<Vec<PathBuf>>>>: Unpin, Rc<RefCell<Output<SecondInstance>>>: Unpin, Rc<RefCell<Output<AppUrlChange>>>: Unpin, Arc<Mutex<Channel>>: Unpin, Rc<RefCell<Output<Result<(), String>>>>: Unpin, Rc<RefCell<Output<Result<Option<Vec<PathBuf>>, String>>>>: Unpin, Rc<RefCell<Output<Result<Option<PathBuf>, String>>>>: Unpin, Box<Composite>: Unpin, Rc<RefCell<Output<f32>>>: Unpin, Rc<RefCell<Output<Instant>>>: Unpin, Box<str>: Unpin, Arc<Inner>: Unpin, Rc<dyn Any>: Unpin, Rc<RefCell<Output<Option<Measurement>>>>: Unpin, Rc<RefCell<Output<Option<ListScrollPosition>>>>: Unpin, Rc<RefCell<Output<Result<Evaluation, JsError>>>>: Unpin, Rc<RefCell<Output<Duration>>>: Unpin,

§

impl UnsafeUnpin for ModuleCx
where *const u8 is !null: UnsafeUnpin, PhantomData<Action>: 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<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> Same for T

Source§

type Output = T

Should always be Self
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.