Trait BlockCapabilityProvider
pub trait BlockCapabilityProvider<T>: Send + Syncwhere
T: ?Sized,{
// Required method
fn provide(
&self,
host: &mut dyn ServerHost,
at: BlockSide,
) -> Option<Box<T>>;
}Expand description
What answers a capability for a block entity of one type: given the block entity and the
side asked about, its handler, or none to leave it to the next provider. A closure
|host, at| Some(Box::new(Tank(at))) is one.
Required Methods§
fn provide(&self, host: &mut dyn ServerHost, at: BlockSide) -> Option<Box<T>>
fn provide(&self, host: &mut dyn ServerHost, at: BlockSide) -> Option<Box<T>>
The handler for the block entity at at, or none.
Trait Implementations§
§impl Wire for Box<dyn BlockCapabilityProvider<dyn ResourceHandler<ItemResource>>>
impl Wire for Box<dyn BlockCapabilityProvider<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 BlockCapabilityProvider<dyn ResourceHandler<ItemResource>>>, WireError>
fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn BlockCapabilityProvider<dyn ResourceHandler<ItemResource>>>, WireError>
Decodes one value, leaving any following bytes for the caller.
§impl Wire for Box<dyn BlockCapabilityProvider<dyn ResourceHandler<FluidResource>>>
impl Wire for Box<dyn BlockCapabilityProvider<dyn ResourceHandler<FluidResource>>>
§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 BlockCapabilityProvider<dyn ResourceHandler<FluidResource>>>, WireError>
fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn BlockCapabilityProvider<dyn ResourceHandler<FluidResource>>>, WireError>
Decodes one value, leaving any following bytes for the caller.
§impl Wire for Box<dyn BlockCapabilityProvider<dyn EnergyHandler>>
impl Wire for Box<dyn BlockCapabilityProvider<dyn EnergyHandler>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".