pub trait IntoHandler<Marker>: Sized {
type Handler: Handler;
// Required method
fn into_handler(self) -> Self::Handler;
// Provided methods
fn no_type_id(self) -> NoTypeId<Self::Handler> { ... }
fn high(self) -> HighPriority<Self::Handler> { ... }
fn low(self) -> LowPriority<Self::Handler> { ... }
}
Expand description
Types which can be converted into Handler
s.
This trait is implemented for all functions that return ()
and whose
arguments are all HandlerParam
s.
Required Associated Types§
Required Methods§
Sourcefn into_handler(self) -> Self::Handler
fn into_handler(self) -> Self::Handler
Performs the conversion into a Handler
.
Provided Methods§
Sourcefn no_type_id(self) -> NoTypeId<Self::Handler>
fn no_type_id(self) -> NoTypeId<Self::Handler>
Ignore this handler’s reported TypeId
. This can be used to add a
specific handler to the world more than once.
§Examples
use evenio::prelude::*;
let mut world = World::new();
let id_1 = world.add_handler(my_handler);
let id_2 = world.add_handler(my_handler.no_type_id());
let id_3 = world.add_handler(my_handler);
assert_ne!(id_1, id_2);
assert_eq!(id_1, id_3);
Sourcefn high(self) -> HighPriority<Self::Handler>
fn high(self) -> HighPriority<Self::Handler>
Returns a wrapper which sets the priority of this handler to
HandlerPriority::High
.
Sourcefn low(self) -> LowPriority<Self::Handler>
fn low(self) -> LowPriority<Self::Handler>
Returns a wrapper which sets the priority of this handler to
HandlerPriority::Low
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.