Crate flutter_rust_bridge

source ·
Expand description

Modules§

Macros§

  • Macro helper to instantiate an RustOpaque<dyn Trait>, as Rust does not support custom DSTs on stable.
  • On WASM, JsValues cannot be shared between scopes but instead can be “transferred”. Rust however is not aware of transferables and therefore cannot capture these values. This macro wraps a closure and returns a TransferClosure on WASM platforms which will capture these special values, or a normal FnOnce on other platforms. Note that the parameter names must match available variables/bindings from the outer scope.

Structs§

Traits§

  • DartSafeDeprecated
  • Provide your own handler to customize how to execute your function calls, etc.
  • A trait to convert between Rust types and Dart Types that could then be sent to the isolate
  • Basically the Into trait. We need this separate trait because we need to implement it for Vec etc. These blanket implementations allow us to accept external types in various places. The initial reason for this was to allow mirrored types in StreamSink<>. See also PR 1285
  • An encoded message

Functions§

  • Setup defaults that is usually useful for a new project. Surely, you are free to customize everything.
  • Spawns a new asynchronous task, returning a JoinHandle for it.
  • Similar to tokio’s spawn_blocking, except that you need to provide a second argumnet. If you are using flutter_rust_bridge, the second argument can be easily provided: Just use FLUTTER_RUST_BRIDGE_HANDLER.thread_pool().
  • Spawns a !Send future on the current LocalSet.

Type Aliases§

Attribute Macros§

  • Attribute to guide code generation.