[][src]Struct lifeline::dyn_bus::DynBusStorage

pub struct DynBusStorage<B> { /* fields omitted */ }

Dynamic bus storage based on trait object slots, for Senders, Receivers, and Resources.

Most values are stored as HashMap<TypeId, BusSlot>

Implementations

impl<B: Bus> DynBusStorage<B>[src]

Links a channel on the bus, locking the state and inserting BusSlots for the sender/receiver pair

pub fn clone_rx<Msg, Bus>(
    &self
) -> Result<<Msg::Channel as Channel>::Rx, TakeChannelError> where
    Msg: Message<B> + 'static, 
[src]

Takes or clones the channel receiver, using the Channel trait implementation. Returns an error if the endpoint cannot be taken.

pub fn clone_tx<Msg, Bus>(
    &self
) -> Result<<Msg::Channel as Channel>::Tx, TakeChannelError> where
    Msg: Message<B> + 'static, 
[src]

Takes or clones the channel sender, using the Channel trait implementation. Returns an error if the endpoint cannot be taken.

pub fn clone_resource<Res>(&self) -> Result<Res, TakeResourceError> where
    Res: Resource<B> + 'static, 
[src]

Takes or clones the resource, using the Storage trait implementation. Returns an error if the resource cannot be taken.

pub fn store_resource<Res: Send + 'static, Bus>(&self, value: Res)[src]

Stores the resource on the bus, overwriting it if it already exists

pub fn store_channel<Msg, Chan, Bus>(
    &self,
    rx: Option<Chan::Rx>,
    tx: Option<Chan::Tx>
) -> Result<(), AlreadyLinkedError> where
    Chan: Channel,
    Msg: 'static, 
[src]

Stores the (Rx, Tx) pair, or either of them if Nones are provided. This consumes the bus slot for this message type. Future calls to store on this message type will fail.

pub fn capacity<Msg>(&self, capacity: usize) -> Result<(), AlreadyLinkedError> where
    Msg: Message<B> + 'static, 
[src]

Writes a capacity to the bus storage, for the given message type. Returns an error if the channel is already linked in the bus storage (as this capacity would do nothing).

Trait Implementations

impl<B: Debug> Debug for DynBusStorage<B>[src]

impl<B: Bus> Default for DynBusStorage<B>[src]

Auto Trait Implementations

impl<B> RefUnwindSafe for DynBusStorage<B> where
    B: RefUnwindSafe
[src]

impl<B> Send for DynBusStorage<B> where
    B: Send
[src]

impl<B> !Sync for DynBusStorage<B>[src]

impl<B> Unpin for DynBusStorage<B> where
    B: Unpin
[src]

impl<B> UnwindSafe for DynBusStorage<B> where
    B: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.