Struct wca::Handler

source ·
pub struct Handler<I, O>(/* private fields */);
Expand description

Routine handle.

let routine = Routine::new
(
  |( args, props )|
  {
    // Do what you need to do

    Ok( () )
  }
);
let routine = Routine::new_with_ctx
(
  | ( args, props ), ctx |
  {
    // Do what you need to do

    Ok( () )
  }
);

Trait Implementations§

source§

impl<I, O> Debug for Handler<I, O>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F, R> From<F> for Handler<(), R>
where R: IntoResult + 'static, F: Fn() -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<(Args, Props), R>
where R: IntoResult + 'static, F: Fn(Args, Props) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<(Context, Args), R>
where R: IntoResult + 'static, F: Fn(Context, Args) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<(Context, Args, Props), R>
where R: IntoResult + 'static, F: Fn(Context, Args, Props) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<(Context, Props), R>
where R: IntoResult + 'static, F: Fn(Context, Props) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<Args, R>
where R: IntoResult + 'static, F: Fn(Args) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<Context, R>
where R: IntoResult + 'static, F: Fn(Context) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<F, R> From<F> for Handler<Props, R>
where R: IntoResult + 'static, F: Fn(Props) -> R + 'static,

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl<I, O> From<Handler<I, O>> for Routine
where I: 'static, O: IntoResult + 'static, Routine: From<Box<dyn Fn(I) -> Result<()>>>,

source§

fn from(value: Handler<I, O>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<I, O> Freeze for Handler<I, O>

§

impl<I, O> !RefUnwindSafe for Handler<I, O>

§

impl<I, O> !Send for Handler<I, O>

§

impl<I, O> !Sync for Handler<I, O>

§

impl<I, O> Unpin for Handler<I, O>

§

impl<I, O> !UnwindSafe for Handler<I, O>

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<S> SetWithType for S

source§

fn set_with_type<T, IntoT>(&mut self, component: IntoT)
where IntoT: Into<T>, S: SetComponent<T, IntoT>,

Function to set value of a component by its type.
source§

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

§

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>,

§

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> Any for T
where T: Any,