Skip to main content

WinitApp

Struct WinitApp 

Source
pub struct WinitApp<S: GlobalState, W>
where W: Clone + Into<Widget>,
{ /* private fields */ }

Implementations§

Source§

impl<S, W> WinitApp<S, W>
where S: GlobalState + Default, W: Clone + Into<Widget> + 'static,

Source

pub fn new(root_widget: W) -> Self

Source

pub fn new_with_global_state(root_widget: W, global_state: S) -> Self

Source

pub fn with_global_state(self, global_state: S) -> Self

Source

pub fn with_key_handler<F>(self, handler: F) -> Self
where F: Fn(&mut S, &KeyCode, u8) -> bool + Send + Sync + 'static,

Source

pub fn with_title(self, title: impl Into<String>) -> Self

Source

pub fn with_test_control_port(self, port: u16) -> Self

Source

pub fn with_mount_selector(self, selector: impl Into<String>) -> Self

Source

pub fn with_state_init<F>(self, init: F) -> Self
where F: FnOnce(&mut S),

Mutate the initial application state before the first frame.

Source

pub fn with_env(self, env: Env) -> Self

Source

pub fn with_design_system<D: DesignSystem>(self, mode: DesignMode) -> Self

Source

pub fn with_sync_env<F>(self, f: F) -> Self
where F: Fn(&S, &mut Env) + Send + Sync + 'static,

Source

pub fn with_frame_hook<F>(self, f: F) -> Self
where F: Fn(&mut S) -> bool + Send + Sync + 'static,

Register a hook that runs on every AboutToWait event with mutable access to the application state. Return true to request a redraw. Useful for polling background services (e.g. LSP) between key events.

Source

pub fn with_async<F>(self, configure: F) -> Self
where F: FnOnce(&mut AsyncRegistry),

Source

pub fn with_notification_host<H>(self, host: H) -> Self

Registers the host implementation used for notification effects.

host receives requests emitted by ctx.effects.notifications(). Use this to install a real OS/browser notification provider in a shell, or a deterministic memory provider in tests.

Source

pub fn with_nfc_host<H>(self, host: H) -> Self
where H: NfcHost,

Registers the host implementation used for NFC effects.

host owns scanning, writing, emulation, and cancellation. Install a provider only for targets or attached reader hardware that can satisfy the NFC contract.

Source

pub fn with_biometric_host<H>(self, host: H) -> Self
where H: BiometricHost,

Registers the host implementation used for biometric authentication effects.

host should map Fission requests to the platform local-authentication system and return typed errors for missing enrollment, cancellation, or unsupported hardware.

Source

pub fn with_passkey_host<H>(self, host: H) -> Self
where H: PasskeyHost,

Registers the host implementation used for passkey/WebAuthn effects.

host should map Fission registration and authentication requests to the platform credential APIs and return WebAuthn data for server-side verification. It should not treat local biometric unlock as proof of identity without server verification.

Source

pub fn with_bluetooth_host<H>(self, host: H) -> Self
where H: BluetoothHost,

Registers the host implementation used for Bluetooth effects.

host owns adapter state, permission, scanning, connecting, reads, writes, and advertising. Use this boundary to keep platform Bluetooth APIs out of shared app reducers.

Source

pub fn with_barcode_scanner_host<H>(self, host: H) -> Self

Registers the host implementation used for barcode scanner effects.

host may run live camera scanning, decode supplied image bytes, or both. Reducers should rely on this provider instead of depending on a specific camera or decoder library.

Source

pub fn with_camera_host<H>(self, host: H) -> Self
where H: CameraHost,

Registers the host implementation used for camera and flashlight effects.

host owns camera availability, permission, photo capture, torch control, and cancellation. Use memory hosts for tests and real OS providers for production shells.

Source

pub fn with_clipboard_host<H>(self, host: H) -> Self
where H: ClipboardHost,

Registers the host implementation used for clipboard effects.

host owns text and typed clipboard access. This is useful for tests, custom shells, or platforms where clipboard behavior differs from the default desktop provider.

Source

pub fn with_geolocation_host<H>(self, host: H) -> Self
where H: GeolocationHost,

Registers the host implementation used for geolocation effects.

host owns permission checks and current-position requests. It should map Fission accuracy and cache controls to the platform location service where available.

Source

pub fn with_haptic_host<H>(self, host: H) -> Self
where H: HapticHost,

Registers the host implementation used for haptic feedback effects.

host owns impact, notification, selection, and pattern playback. It should return unsupported errors on devices without tactile hardware.

Source

pub fn with_microphone_host<H>(self, host: H) -> Self
where H: MicrophoneHost,

Registers the host implementation used for microphone effects.

host owns input-device availability, permission, bounded recording, and cancellation. Keep recording code behind this provider boundary.

Source

pub fn with_wifi_host<H>(self, host: H) -> Self
where H: WifiHost,

Registers the host implementation used for Wi-Fi effects.

host owns adapter availability, permission, scanning, connection, and disconnection. Platform Wi-Fi APIs are permission-sensitive, so unsupported and denied states should be reported explicitly.

Source

pub fn with_volume_host<H>(self, host: H) -> Self
where H: VolumeHost,

Registers the host implementation used for volume-control effects.

host maps Fission volume streams to the platform mixer or media control model. It should return unsupported errors when the target cannot expose system volume control to apps.

Source

pub fn with_startup_action<A: Action>(self, action: A) -> Self

Installs the deep-link filter used by this shell.

config declares accepted schemes, domains, and path prefixes. The shell uses it to classify inbound links before dispatching DeepLinkReceived actions into the app.

Adds one accepted custom deep-link scheme.

scheme is normalized by DeepLinkConfig. Use this for app-specific routes such as myapp://item/123.

Adds one accepted HTTP or HTTPS deep-link domain.

domain is normalized by DeepLinkConfig. Use this for verified app links, universal links, or web URLs that should enter the app.

Queues a deep link to dispatch after the app starts.

Use this from host startup code when the platform launched the app because of an external URL. The link is delivered through the normal action path.

Source

pub fn with_startup_notification_response( self, response: NotificationResponse, ) -> Self

Queues a notification response to dispatch after the app starts.

Use this when a notification action or tap launched the app. The response is delivered as NotificationResponseReceived through the normal reducer path.

Registers a reducer handler for inbound deep links.

handler receives DeepLinkReceived actions from startup links and runtime host events. Use it to update routing state rather than parsing deep links inside widgets.

Source

pub fn on_notification_response<H>(self, handler: H) -> Self

Registers a reducer handler for notification responses.

handler receives NotificationResponseReceived actions when the user taps or acts on a notification. Use it to route the user or process action ids in normal app state.

Source

pub fn register_reducer( &mut self, action_id: ActionId, reducer: Reducer<S>, ) -> Result<()>

Source

pub fn absorb_registry(&mut self, registry: ActionRegistry<S>)

Source

pub fn run(self) -> Result<()>

Auto Trait Implementations§

§

impl<S, W> Freeze for WinitApp<S, W>
where W: Freeze,

§

impl<S, W> !RefUnwindSafe for WinitApp<S, W>

§

impl<S, W> Send for WinitApp<S, W>
where W: Send,

§

impl<S, W> !Sync for WinitApp<S, W>

§

impl<S, W> Unpin for WinitApp<S, W>
where W: Unpin, S: Unpin,

§

impl<S, W> UnsafeUnpin for WinitApp<S, W>
where W: UnsafeUnpin,

§

impl<S, W> !UnwindSafe for WinitApp<S, W>

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> Upcast<T> for T

Source§

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

Source§

impl<T> WasmNotSend for T
where T: Send,