Skip to main content

BlockCapabilityProvider

Trait BlockCapabilityProvider 

pub trait BlockCapabilityProvider<T>: Send + Sync
where 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>>

The handler for the block entity at at, or none.

Trait Implementations§

§

impl Wire for Box<dyn BlockCapabilityProvider<dyn ResourceHandler<ItemResource>>>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the 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>

Decodes one value, leaving any following bytes for the caller.
§

impl Wire for Box<dyn BlockCapabilityProvider<dyn ResourceHandler<FluidResource>>>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the 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>

Decodes one value, leaving any following bytes for the caller.
§

impl Wire for Box<dyn BlockCapabilityProvider<dyn EnergyHandler>>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the 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 EnergyHandler>>, 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".

Implementors§

§

impl<T, F> BlockCapabilityProvider<T> for F
where F: Fn(&mut dyn ServerHost, BlockSide) -> Option<Box<T>> + Send + Sync, T: ?Sized,