pub struct WinitApp<S: AppState, W: Widget<S>> { /* private fields */ }Implementations§
Source§impl<S: AppState + Default, W: Widget<S> + 'static> WinitApp<S, W>
impl<S: AppState + Default, W: Widget<S> + 'static> WinitApp<S, W>
pub fn new(root_widget: W) -> Self
pub fn with_key_handler<F>(self, handler: F) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_test_control_port(self, port: u16) -> Self
pub fn with_mount_selector(self, selector: impl Into<String>) -> Self
Sourcepub fn with_state_init<F>(self, init: F) -> Self
pub fn with_state_init<F>(self, init: F) -> Self
Mutate the initial application state before the first frame.
pub fn with_env(self, env: Env) -> Self
pub fn with_design_system<D: DesignSystem>(self, mode: DesignMode) -> Self
pub fn with_sync_env<F>(self, f: F) -> Self
Sourcepub fn with_frame_hook<F>(self, f: F) -> Self
pub fn with_frame_hook<F>(self, f: F) -> Self
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.
pub fn with_async<F>(self, configure: F) -> Selfwhere
F: FnOnce(&mut AsyncRegistry),
Sourcepub fn with_notification_host<H>(self, host: H) -> Selfwhere
H: NotificationHost,
pub fn with_notification_host<H>(self, host: H) -> Selfwhere
H: NotificationHost,
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.
Sourcepub fn with_nfc_host<H>(self, host: H) -> Selfwhere
H: NfcHost,
pub fn with_nfc_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_biometric_host<H>(self, host: H) -> Selfwhere
H: BiometricHost,
pub fn with_biometric_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_passkey_host<H>(self, host: H) -> Selfwhere
H: PasskeyHost,
pub fn with_passkey_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_bluetooth_host<H>(self, host: H) -> Selfwhere
H: BluetoothHost,
pub fn with_bluetooth_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_barcode_scanner_host<H>(self, host: H) -> Selfwhere
H: BarcodeScannerHost,
pub fn with_barcode_scanner_host<H>(self, host: H) -> Selfwhere
H: BarcodeScannerHost,
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.
Sourcepub fn with_camera_host<H>(self, host: H) -> Selfwhere
H: CameraHost,
pub fn with_camera_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_clipboard_host<H>(self, host: H) -> Selfwhere
H: ClipboardHost,
pub fn with_clipboard_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_geolocation_host<H>(self, host: H) -> Selfwhere
H: GeolocationHost,
pub fn with_geolocation_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_haptic_host<H>(self, host: H) -> Selfwhere
H: HapticHost,
pub fn with_haptic_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_microphone_host<H>(self, host: H) -> Selfwhere
H: MicrophoneHost,
pub fn with_microphone_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_wifi_host<H>(self, host: H) -> Selfwhere
H: WifiHost,
pub fn with_wifi_host<H>(self, host: H) -> Selfwhere
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.
Sourcepub fn with_volume_host<H>(self, host: H) -> Selfwhere
H: VolumeHost,
pub fn with_volume_host<H>(self, host: H) -> Selfwhere
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.
pub fn with_startup_action<A: Action>(self, action: A) -> Self
Sourcepub fn with_deep_link_config(self, config: DeepLinkConfig) -> Self
pub fn with_deep_link_config(self, config: DeepLinkConfig) -> 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.
Sourcepub fn with_deep_link_scheme(self, scheme: impl Into<String>) -> Self
pub fn with_deep_link_scheme(self, scheme: impl Into<String>) -> Self
Adds one accepted custom deep-link scheme.
scheme is normalized by DeepLinkConfig. Use this for app-specific
routes such as myapp://item/123.
Sourcepub fn with_deep_link_domain(self, domain: impl Into<String>) -> Self
pub fn with_deep_link_domain(self, domain: impl Into<String>) -> Self
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.
Sourcepub fn with_startup_deep_link(self, link: DeepLink) -> Self
pub fn with_startup_deep_link(self, link: DeepLink) -> Self
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.
Sourcepub fn with_startup_notification_response(
self,
response: NotificationResponse,
) -> Self
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.
Sourcepub fn on_deep_link<H>(self, handler: H) -> Self
pub fn on_deep_link<H>(self, handler: H) -> Self
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.
Sourcepub fn on_notification_response<H>(self, handler: H) -> Self
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.
pub fn register_reducer( &mut self, action_id: ActionId, reducer: fn(&mut S, &ActionEnvelope, NodeId) -> Result<()>, ) -> Result<()>
pub fn absorb_registry(&mut self, registry: ActionRegistry<S>)
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>
impl<S, W> UnsafeUnpin for WinitApp<S, W>where
W: UnsafeUnpin,
impl<S, W> !UnwindSafe for WinitApp<S, W>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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