Struct SimpleHandler

Source
pub struct SimpleHandler<E: Executor, EL: ErrorListener> { /* private fields */ }
Expand description

The simple handler uses a simple thread pool to execute tasks.

Implementations§

Source§

impl<TP: BaseThreadPool> SimpleHandler<SimpleExecutor<NoOpErrorListener, TP, SimpleAsyncRuntime>, NoOpErrorListener>

Source

pub fn new_simple(thread_pool: TP) -> Self

Source

pub fn thread_pool(&self) -> &TP

Source

pub fn async_runtime(&self) -> &SimpleAsyncRuntime

Source§

impl<E: Executor, H: ErrorListener> SimpleHandler<E, H>

Source

pub fn new(executor: E, error_listener: H) -> Self

Create a new default handler.

Trait Implementations§

Source§

impl<E: Executor, EL: ErrorListener> Handler for SimpleHandler<E, EL>

Source§

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

Prepares the arguments, executes a Rust function and sets up its return value. Read more
Source§

fn wrap_sync<Rust2DartCodec, SyncTaskFn>( &self, task_info: TaskInfo, sync_task: SyncTaskFn, ) -> <Rust2DartCodec::Message as Rust2DartMessageTrait>::WireSyncRust2DartType
where SyncTaskFn: FnOnce() -> Result<Rust2DartCodec::Message, Rust2DartCodec::Message>, Rust2DartCodec: BaseCodec,

Same as [wrap][Handler::wrap], but the Rust function will be called synchronously and need not implement Send.
Source§

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

Same as [wrap][Handler::wrap], but for async Rust.
Source§

fn dart_fn_invoke( &self, dart_fn: DartOpaque, args: Vec<DartAbi>, ) -> DartFnFuture<Dart2RustMessageSse>

Source§

fn dart_fn_handle_output(&self, call_id: i32, message: Dart2RustMessageSse)

Auto Trait Implementations§

§

impl<E, EL> !Freeze for SimpleHandler<E, EL>

§

impl<E, EL> RefUnwindSafe for SimpleHandler<E, EL>

§

impl<E, EL> Send for SimpleHandler<E, EL>
where E: Send,

§

impl<E, EL> Sync for SimpleHandler<E, EL>
where E: Sync, EL: Sync,

§

impl<E, EL> Unpin for SimpleHandler<E, EL>
where E: Unpin, EL: Unpin,

§

impl<E, EL> UnwindSafe for SimpleHandler<E, EL>
where E: UnwindSafe, EL: 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,