Trait EntityCapabilityProvider
pub trait EntityCapabilityProvider<T, C>: Send + Syncwhere
T: ?Sized,{
// Required method
fn provide(
&self,
host: &mut dyn ServerHost,
entity: EntityRef,
context: C,
) -> Option<Box<T>>;
}Expand description
What answers an entity capability for one entity type: given the entity and the lookup’s
context (its EntityCapabilityKey’s C), its handler, or none to leave it to the next
provider. A closure is one.
Required Methods§
fn provide(
&self,
host: &mut dyn ServerHost,
entity: EntityRef,
context: C,
) -> Option<Box<T>>
fn provide( &self, host: &mut dyn ServerHost, entity: EntityRef, context: C, ) -> Option<Box<T>>
The handler for entity, asked with context, or none.
Trait Implementations§
§impl Wire for Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, ()>>
impl Wire for Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, ()>>
§fn put_owned(self, out: &mut Writer)
fn put_owned(self, out: &mut Writer)
Consumes owned data when a resource’s ownership must cross the boundary.
§fn take(
input: &mut Reader<'_>,
) -> Result<Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, ()>>, WireError>
fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, ()>>, WireError>
Decodes one value, leaving any following bytes for the caller.
§impl Wire for Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, Option<Direction>>>
impl Wire for Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, Option<Direction>>>
§fn put_owned(self, out: &mut Writer)
fn put_owned(self, out: &mut Writer)
Consumes owned data when a resource’s ownership must cross the boundary.
§fn take(
input: &mut Reader<'_>,
) -> Result<Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, Option<Direction>>>, WireError>
fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn EntityCapabilityProvider<dyn ResourceHandler<ItemResource>, Option<Direction>>>, WireError>
Decodes one value, leaving any following bytes for the caller.
§impl Wire for Box<dyn EntityCapabilityProvider<dyn ResourceHandler<FluidResource>, Option<Direction>>>
impl Wire for Box<dyn EntityCapabilityProvider<dyn ResourceHandler<FluidResource>, Option<Direction>>>
§fn put_owned(self, out: &mut Writer)
fn put_owned(self, out: &mut Writer)
Consumes owned data when a resource’s ownership must cross the boundary.
§fn take(
input: &mut Reader<'_>,
) -> Result<Box<dyn EntityCapabilityProvider<dyn ResourceHandler<FluidResource>, Option<Direction>>>, WireError>
fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn EntityCapabilityProvider<dyn ResourceHandler<FluidResource>, Option<Direction>>>, WireError>
Decodes one value, leaving any following bytes for the caller.
§impl Wire for Box<dyn EntityCapabilityProvider<dyn EnergyHandler, Option<Direction>>>
impl Wire for Box<dyn EntityCapabilityProvider<dyn EnergyHandler, Option<Direction>>>
§fn put_owned(self, out: &mut Writer)
fn put_owned(self, out: &mut Writer)
Consumes owned data when a resource’s ownership must cross the boundary.
§fn take(
input: &mut Reader<'_>,
) -> Result<Box<dyn EntityCapabilityProvider<dyn EnergyHandler, Option<Direction>>>, WireError>
fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn EntityCapabilityProvider<dyn EnergyHandler, Option<Direction>>>, WireError>
Decodes one value, leaving any following bytes for the caller.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".