[][src]Struct statefun::FunctionRegistry

pub struct FunctionRegistry { /* fields omitted */ }

Keeps a mapping from FunctionType to stateful functions. Use this together with a Transport to serve stateful functions.

Use register_fn() to register functions before handing the registry over to a Transport for serving.

Implementations

impl FunctionRegistry[src]

pub fn new() -> FunctionRegistry[src]

Creates a new empty FunctionRegistry.

pub fn register_fn<I: Message, F: Fn(Context, I) -> Effects + Send + 'static>(
    &mut self,
    function_type: FunctionType,
    function: F
)
[src]

Registers the given function under the function_type.

pub fn invoke(
    &self,
    target_function: FunctionType,
    context: Context,
    message: Any
) -> Result<Effects, Error>
[src]

Invokes the function that is registered for the given FunctionType. This will return Err if no function is registered under the given type.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.