Struct allo_isolate::Isolate[][src]

pub struct Isolate { /* fields omitted */ }
Expand description

Simple wrapper around the Dart Isolate Port, nothing else.

Implementations

Create a new Isolate with a port obtained from Dart VM side.

Example

this a non realistic example lol :D

let isolate = Isolate::new(42);

Post an object to the Isolate over the port Object must implement IntoDart.

returns true if the message posted successfully, otherwise false

Safety

This assumes that you called store_dart_post_cobject and we have access to the Dart_PostCObject function pointer also, we do check if it is not null.

Example
let isolate = Isolate::new(42);
isolate.post("Hello Dart !");

Consumes Self, Runs the task, await for the result and then post it to the Isolate over the port Result must implement IntoDart.

returns true if the message posted successfully, otherwise false

Safety

This assumes that you called store_dart_post_cobject and we have access to the Dart_PostCObject function pointer also, we do check if it is not null.

Example
use async_std::task;
let isolate = Isolate::new(42);
task::spawn(isolate.task(async { 1 + 2 }));

Similar to Isolate::task but with more logic to catch any panic and report it back

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.