[−][src]Struct statefun::FunctionRegistry
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]
&mut self,
function_type: FunctionType,
function: F
)
Registers the given function under the function_type
.
pub fn invoke(
&self,
target_function: FunctionType,
context: Context,
message: Any
) -> Result<Effects, Error>
[src]
&self,
target_function: FunctionType,
context: Context,
message: Any
) -> Result<Effects, Error>
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
impl !RefUnwindSafe for FunctionRegistry
impl Send for FunctionRegistry
impl !Sync for FunctionRegistry
impl Unpin for FunctionRegistry
impl !UnwindSafe for FunctionRegistry
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,