Module asynchronous

Source
Expand description

Asynchronous utilities for MolyKit.

Mainly helps you to deal with the runtime differences across native and web and do workaround integrations of async code in Makepad.

For example: rfd::FileHandle is Send on native, but not on web. And on web it may need to be send back to the UI through Cx::post_action which requires Send unconditionally.

Since Makepad doesn’t expose an equivalent to wasm_bindgen_futures::spawn_local tied to its own event loop, we need to run Tokio on a separate thread which causes problems with Send.

Structs§

AbortOnDropHandle
A handle that aborts its associated future when dropped.
ThreadToken
Holds a value inside a thread-local storage.

Traits§

PlatformSend
Implies Send only on native platforms, but not on WASM.
PlatformSendFuture
A future that requires Send on native platforms, but not on WASM.
PlatformSendInner
PlatformSendStream
A stream that requires Send on native platforms, but not on WASM.

Functions§

abort_on_drop
Constructs a future + AbortOnDropHandle pair.
spawn
Runs a future independently, in a platform-specific way.

Type Aliases§

BoxPlatformSendFuture
An owned dynamically typed Future that only requires Send on native platforms, but not on WASM.
BoxPlatformSendStream
An owned dynamically typed Stream that only requires Send on native platforms, but not on WASM.