logo

Crate allo_isolate[][src]

Expand description

Allo Isolate Run Multithreaded Rust along with Dart VM (in isolate).

Since you can’t call into dart from other threads other than the main thread, that holds our rust code from beaing multithreaded, the way that can be done is using Dart Isolate by creating an isolate, send its NativePort to Rust side, then rust is freely could run and send the result back on that port.

Interacting with Dart VM directly isn’t that easy, that is why we created that library, it provides IntoDart trait to convert between Rust data types and Dart Types, and by default it is implemented for all common rust types.

Example

See flutterust and how we used it in the scrap package to create a webscrapper using Rust and Flutter.

Re-exports

pub use ffi::ZeroCopyBuffer;

Modules

Structs

Simple wrapper around the Dart Isolate Port, nothing else.

Traits

A trait to convert between Rust types and Dart Types that could then be sent to the isolate

A trait that is IntoDart and is also not a primitive type. It is used to avoid the ambiguity of whether types such as Vec<i32> should be converted into [Int32List] or [List<int>]

Functions

Stores the function pointer of Dart_PostCObject, this only should be called once at the start up of the Dart/Flutter Application. it is exported and marked as #[no_mangle].