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>
impl<EL: ErrorListener, TP: BaseThreadPool, AR: BaseAsyncRuntime> SimpleExecutor<EL, TP, AR>
Sourcepub fn new(error_listener: EL, thread_pool: TP, async_runtime: AR) -> Self
pub fn new(error_listener: EL, thread_pool: TP, async_runtime: AR) -> Self
Create a new executor backed by a thread pool.
pub fn thread_pool(&self) -> &TP
pub fn async_runtime(&self) -> &AR
Trait Implementations§
Source§impl<EL: ErrorListener + Sync, TP: BaseThreadPool, AR: BaseAsyncRuntime> Executor for SimpleExecutor<EL, TP, AR>
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,
)
fn execute_normal<Rust2DartCodec, TaskFn>( &self, task_info: TaskInfo, task: TaskFn, )
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
fn execute_sync<Rust2DartCodec, SyncTaskFn>( &self, _task_info: TaskInfo, sync_task: SyncTaskFn, ) -> Rust2DartCodec::Message
Executes a synchronous Rust function
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>
impl<EL, TP, AR> RefUnwindSafe for SimpleExecutor<EL, TP, AR>
impl<EL, TP, AR> Send for SimpleExecutor<EL, TP, AR>
impl<EL, TP, AR> Sync for SimpleExecutor<EL, TP, AR>
impl<EL, TP, AR> Unpin for SimpleExecutor<EL, TP, AR>
impl<EL, TP, AR> UnwindSafe for SimpleExecutor<EL, TP, AR>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more