Skip to main content

ItemCapabilityProvider

Trait ItemCapabilityProvider 

pub trait ItemCapabilityProvider<T>: Send + Sync
where T: ?Sized,
{ // Required method fn provide( &self, host: &mut dyn ServerHost, at: &ItemPlace, ) -> Option<Box<T>>; }
Expand description

What answers an item capability for one item: given where the stack lives, its handler, or none to leave it to the next provider. A closure is one.

Required Methods§

fn provide(&self, host: &mut dyn ServerHost, at: &ItemPlace) -> Option<Box<T>>

The handler for the stack at at, or none.

Trait Implementations§

§

impl Wire for Box<dyn ItemCapabilityProvider<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 ItemCapabilityProvider<dyn ResourceHandler<ItemResource>>>, WireError>

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

impl Wire for Box<dyn ItemCapabilityProvider<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 ItemCapabilityProvider<dyn ResourceHandler<FluidResource>>>, WireError>

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

impl Wire for Box<dyn ItemCapabilityProvider<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 ItemCapabilityProvider<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> ItemCapabilityProvider<T> for F
where F: Fn(&mut dyn ServerHost, &ItemPlace) -> Option<Box<T>> + Send + Sync, T: ?Sized,