Skip to main content

CommandEntry

Struct CommandEntry 

Source
pub struct CommandEntry<K, C, R, O, E> { /* private fields */ }
Expand description

One command in a static dispatch table.

The entry stores only its key and an erased function pointer. It owns no context or resources and requires no heap allocation.

Implementations§

Source§

impl<K, C, R, O, E> CommandEntry<K, C, R, O, E>

Source

pub const fn new(key: K, handler: CommandHandler<C, R, O, E>) -> Self

Creates an entry from a key and already-erased handler function.

Applications normally use crate::command! to generate handler.

Source

pub const fn key(&self) -> &K

Returns the command key.

Source

pub fn invoke( &self, context: &mut C, resources: &mut R, ) -> Result<O, StageError<E>>

Invokes the command without performing matching.

Auto Trait Implementations§

§

impl<K, C, R, O, E> Freeze for CommandEntry<K, C, R, O, E>
where K: Freeze, fn(&mut C, &mut R) -> Result<O, StageError<E>>: Freeze,

§

impl<K, C, R, O, E> RefUnwindSafe for CommandEntry<K, C, R, O, E>

§

impl<K, C, R, O, E> Send for CommandEntry<K, C, R, O, E>
where K: Send, fn(&mut C, &mut R) -> Result<O, StageError<E>>: Send,

§

impl<K, C, R, O, E> Sync for CommandEntry<K, C, R, O, E>
where K: Sync, fn(&mut C, &mut R) -> Result<O, StageError<E>>: Sync,

§

impl<K, C, R, O, E> Unpin for CommandEntry<K, C, R, O, E>
where K: Unpin, fn(&mut C, &mut R) -> Result<O, StageError<E>>: Unpin,

§

impl<K, C, R, O, E> UnsafeUnpin for CommandEntry<K, C, R, O, E>

§

impl<K, C, R, O, E> UnwindSafe for CommandEntry<K, C, R, O, E>

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.