[][src]Trait lifeline::dyn_bus::DynBus

pub trait DynBus: Bus {
    fn store_rx<Msg>(
        &self,
        rx: <Msg::Channel as Channel>::Rx
    ) -> Result<(), AlreadyLinkedError>
    where
        Msg: Message<Self> + 'static
;
fn store_tx<Msg>(
        &self,
        tx: <Msg::Channel as Channel>::Tx
    ) -> Result<(), AlreadyLinkedError>
    where
        Msg: Message<Self> + 'static
;
fn store_channel<Msg>(
        &self,
        rx: <Msg::Channel as Channel>::Rx,
        tx: <Msg::Channel as Channel>::Tx
    ) -> Result<(), AlreadyLinkedError>
    where
        Msg: Message<Self> + 'static
;
fn store_resource<R: Resource<Self>>(&self, resource: R);
fn storage(&self) -> &DynBusStorage<Self>; }

An extension trait which defines operations on a DynBus, which stores box dyn trait objects internally.

DynBus implementations are created using the lifeline_bus! macro.

Required methods

fn store_rx<Msg>(
    &self,
    rx: <Msg::Channel as Channel>::Rx
) -> Result<(), AlreadyLinkedError> where
    Msg: Message<Self> + 'static, 

Stores an manually constructed Receiver on the bus, for the provided message type.

This is useful if you need to link a lifeline bus to other async message-based code.

If the message channel has already been linked (from a call to bus.rx, bus.tx, or bus.capacity), returns an error.

fn store_tx<Msg>(
    &self,
    tx: <Msg::Channel as Channel>::Tx
) -> Result<(), AlreadyLinkedError> where
    Msg: Message<Self> + 'static, 

Stores an manually constructed Sender on the bus, for the provided message type.

This is useful if you need to link a lifeline bus to other async message-based code.

If the message channel has already been linked (from a call to bus.rx, bus.tx, or bus.capacity), returns an error.

fn store_channel<Msg>(
    &self,
    rx: <Msg::Channel as Channel>::Rx,
    tx: <Msg::Channel as Channel>::Tx
) -> Result<(), AlreadyLinkedError> where
    Msg: Message<Self> + 'static, 

Stores a channel pair on the bus, for the provided message type.

If the message channel has already been linked (from a call to bus.rx, bus.tx, or bus.capacity), returns an error.

fn store_resource<R: Resource<Self>>(&self, resource: R)

Stores a resource on the bus.

Resources are commonly used for clonable configuration structs, or takeable resources such as websocket connections.

fn storage(&self) -> &DynBusStorage<Self>

Returns the DynBusStorage struct which manages the trait object slots.

Loading content...

Implementors

Loading content...