Struct handler_map::HandlerMap [−][src]
pub struct HandlerMap(_);
Struct that maps types with functions or closures that can receive them.
See the module-level documentation for more information.
Methods
impl HandlerMap
[src]
impl HandlerMap
pub fn new() -> HandlerMap
[src]
pub fn new() -> HandlerMap
Creates a new map with no handlers.
pub fn insert<T: Any, F: Fn(T) + 'static>(&mut self, handler: F)
[src]
pub fn insert<T: Any, F: Fn(T) + 'static>(&mut self, handler: F)
Registers a new handler into the map.
pub fn remove<T: Any>(&mut self)
[src]
pub fn remove<T: Any>(&mut self)
Un-registers the handler for the given type from this map.
pub fn is_registered<T: Any>(&self) -> bool
[src]
pub fn is_registered<T: Any>(&self) -> bool
Returns true if the given message type has a handler registered in the map.
pub fn val_is_registered<T: Any>(&self, _msg: &T) -> bool
[src]
pub fn val_is_registered<T: Any>(&self, _msg: &T) -> bool
Returns true if the given message has a handler registered in this map.
This is the same operation as is_registered
, but allows you to call it with a value
rather than having to supply the type.
pub fn call<T: Any>(&self, msg: T) -> bool
[src]
pub fn call<T: Any>(&self, msg: T) -> bool
Calls the handler with the given message, returning whether the handler was registered.
Trait Implementations
impl Default for HandlerMap
[src]
impl Default for HandlerMap
fn default() -> HandlerMap
[src]
fn default() -> HandlerMap
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl Send for HandlerMap
impl Send for HandlerMap
impl Sync for HandlerMap
impl Sync for HandlerMap