Skip to main content

EventsFnHandler

Struct EventsFnHandler 

Source
pub struct EventsFnHandler<F, E, T, R = SummaryResult<T>>
where E: Serialize + 'static, T: Serialize,
{ /* private fields */ }
Expand description

The adapter behind a three-argument closure, whose third parameter is the command’s typed results channel, so Event is the closure’s event type.

Implementations§

Source§

impl<F, E, T, R> EventsFnHandler<F, E, T, R>
where F: FnMut(&ArgMatches, &CommandContext, &mut Results<E>) -> R, R: IntoSummaryResult<T>, E: Serialize + 'static, T: Serialize,

Source

pub fn new(f: F) -> Self

Trait Implementations§

Source§

impl<F, E, T, R> Handler for EventsFnHandler<F, E, T, R>
where F: FnMut(&ArgMatches, &CommandContext, &mut Results<E>) -> R, R: IntoSummaryResult<T>, E: Serialize + 'static, T: Serialize,

Source§

type Event = E

The type of the values the command produces while it runs, or NoEvents for a command that produces none, which is what emits_events reads.
Source§

type Output = T

Source§

type Outcome = Summary<T>

Output for a batch command, Summary for one that declares events: HandlerOutcome admits the first only under NoEvents.
Source§

fn handle( &mut self, matches: &ArgMatches, ctx: &CommandContext, results: &mut Results<E>, ) -> SummaryResult<T>

Source§

fn expected_args(&self) -> Vec<ExpectedArg>

Auto Trait Implementations§

§

impl<F, E, T, R> Freeze for EventsFnHandler<F, E, T, R>

§

impl<F, E, T, R> RefUnwindSafe for EventsFnHandler<F, E, T, R>

§

impl<F, E, T, R> Send for EventsFnHandler<F, E, T, R>
where F: Send, PhantomData<fn(E)>: Send, PhantomData<fn() -> (T, R)>: Send,

§

impl<F, E, T, R> Sync for EventsFnHandler<F, E, T, R>
where F: Sync, PhantomData<fn(E)>: Sync, PhantomData<fn() -> (T, R)>: Sync,

§

impl<F, E, T, R> Unpin for EventsFnHandler<F, E, T, R>

§

impl<F, E, T, R> UnsafeUnpin for EventsFnHandler<F, E, T, R>

§

impl<F, E, T, R> UnwindSafe for EventsFnHandler<F, E, T, R>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.