pub struct Handler { /* private fields */ }Expand description
A registered step handler: a closure over (state, args_after_state).
Implementations§
Source§impl Handler
impl Handler
Sourcepub fn noop() -> Handler
pub fn noop() -> Handler
A no-op handler (arity-agnostic) — used where a handler is never invoked.
Sourcepub fn new(
f: impl Fn(Rc<dyn Any>, Vec<Value>) -> HandlerReturn + 'static,
) -> Handler
pub fn new( f: impl Fn(Rc<dyn Any>, Vec<Value>) -> HandlerReturn + 'static, ) -> Handler
Builds a handler from a raw closure over the opaque state and the slot
arguments. The facade’s typed stimulus/sensor build these; authors
use those instead.
Sourcepub fn sync0(
f: impl Fn(Value) -> Result<Option<Value>, HandlerError> + 'static,
) -> Handler
pub fn sync0( f: impl Fn(Value) -> Result<Option<Value>, HandlerError> + 'static, ) -> Handler
Fixed-arity conveniences over a Value state. These exist for the
core’s own tests and for any consumer not using the varar facade —
the facade builds handlers from typed closures instead, so an author
never calls these.
Sourcepub fn sync1(
f: impl Fn(Value, Value) -> Result<Option<Value>, HandlerError> + 'static,
) -> Handler
pub fn sync1( f: impl Fn(Value, Value) -> Result<Option<Value>, HandlerError> + 'static, ) -> Handler
A synchronous 1-argument handler (state, a).
Sourcepub fn sync2(
f: impl Fn(Value, Value, Value) -> Result<Option<Value>, HandlerError> + 'static,
) -> Handler
pub fn sync2( f: impl Fn(Value, Value, Value) -> Result<Option<Value>, HandlerError> + 'static, ) -> Handler
A synchronous 2-argument handler (state, a, b).
Sourcepub fn state1(
f: impl Fn(Value, Value) -> Result<Value, HandlerError> + 'static,
) -> Handler
pub fn state1( f: impl Fn(Value, Value) -> Result<Value, HandlerError> + 'static, ) -> Handler
As Handler::sync1, but its result is the next state rather than a
value to compare.
Sourcepub fn async0(
f: impl Fn(Value) -> Pin<Box<dyn Future<Output = HandlerReturn>>> + 'static,
) -> Handler
pub fn async0( f: impl Fn(Value) -> Pin<Box<dyn Future<Output = HandlerReturn>>> + 'static, ) -> Handler
An asynchronous 0-argument handler returning a Future.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Handler
impl !Send for Handler
impl !Sync for Handler
impl !UnwindSafe for Handler
impl Freeze for Handler
impl Unpin for Handler
impl UnsafeUnpin for Handler
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more