[][src]Module lifeline::prelude

Prelude, including all the traits and types required for typical lifeline usage.

Re-exports

pub use crate::lifeline_bus;

Structs

Lifeline

A lifeline value, associated with a future spawned via the Task trait. When the lifeline is dropped, the associated future is immediately cancelled.

Traits

Bus

Stores and distributes channel endpoints (Senders and Receivers), as well as Resource values.

CarryFrom

Carries messages between two bus instances. A variant of the Service.

CarryInto

The receprocial of the CarryFrom trait. Implemented for all types on which CarryFrom is implemented.

Message

Attaches a channel to the Bus, carrying Self as a message.

Receiver

The receiver half of an asynchronous channel, which may be bounded/unbounded, mpsc/broadcast/oneshot, etc.

Resource

Attaches a resource to the Bus. This resource can accessed from the bus using bus.resource::<Self>().

Sender

The sender half of an asynchronous channel, which may be bounded/unbounded, mpsc/broadcast/oneshot, etc.

Service

Takes channels from the Bus, and spawns a tree of tasks. Returns one or more Lifeline values.
When the Lifeline is dropped, the task tree is immediately cancelled.

Task

Provides the Self::task and Self::try_task associated methods for all types.