Struct SimpleExecutor

Source
pub struct SimpleExecutor<EL: ErrorListener, TP: BaseThreadPool, AR: BaseAsyncRuntime> { /* private fields */ }
Expand description

The default executor used. It creates an internal thread pool, and each call to a Rust function is handled by a different thread.

Implementations§

Source§

impl<EL: ErrorListener, TP: BaseThreadPool, AR: BaseAsyncRuntime> SimpleExecutor<EL, TP, AR>

Source

pub fn new(error_listener: EL, thread_pool: TP, async_runtime: AR) -> Self

Create a new executor backed by a thread pool.

Source

pub fn thread_pool(&self) -> &TP

Source

pub fn async_runtime(&self) -> &AR

Trait Implementations§

Source§

impl<EL: ErrorListener + Sync, TP: BaseThreadPool, AR: BaseAsyncRuntime> Executor for SimpleExecutor<EL, TP, AR>

Source§

fn execute_normal<Rust2DartCodec, TaskFn>( &self, task_info: TaskInfo, task: TaskFn, )
where TaskFn: FnOnce(TaskContext) -> Result<Rust2DartCodec::Message, Rust2DartCodec::Message> + Send + 'static, Rust2DartCodec: BaseCodec,

Executes a Rust function and transforms its return value into a Dart-compatible value, i.e. types that implement [IntoDart].
Source§

fn execute_sync<Rust2DartCodec, SyncTaskFn>( &self, _task_info: TaskInfo, sync_task: SyncTaskFn, ) -> Rust2DartCodec::Message
where SyncTaskFn: FnOnce() -> Result<Rust2DartCodec::Message, Rust2DartCodec::Message>, Rust2DartCodec: BaseCodec,

Executes a synchronous Rust function
Source§

fn execute_async<Rust2DartCodec, TaskFn, TaskRetFut>( &self, task_info: TaskInfo, task: TaskFn, )
where TaskFn: FnOnce(TaskContext) -> TaskRetFut + Send + 'static, TaskRetFut: Future<Output = Result<Rust2DartCodec::Message, Rust2DartCodec::Message>> + TaskRetFutTrait, Rust2DartCodec: BaseCodec,

Auto Trait Implementations§

§

impl<EL, TP, AR> Freeze for SimpleExecutor<EL, TP, AR>
where EL: Freeze, TP: Freeze, AR: Freeze,

§

impl<EL, TP, AR> RefUnwindSafe for SimpleExecutor<EL, TP, AR>

§

impl<EL, TP, AR> Send for SimpleExecutor<EL, TP, AR>
where TP: Send, AR: Send,

§

impl<EL, TP, AR> Sync for SimpleExecutor<EL, TP, AR>
where EL: Sync, TP: Sync, AR: Sync,

§

impl<EL, TP, AR> Unpin for SimpleExecutor<EL, TP, AR>
where EL: Unpin, TP: Unpin, AR: Unpin,

§

impl<EL, TP, AR> UnwindSafe for SimpleExecutor<EL, TP, AR>
where EL: UnwindSafe, TP: UnwindSafe, AR: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DartSafe for T

Source§

impl<T> TaskRetFutTrait for T
where T: Send,