[][src]Struct async_backplane::Device

pub struct Device { /* fields omitted */ }

A Device connects a Future to the backplane.

Implementations

impl Device[src]

pub fn new() -> Self[src]

Creates a new Device.

pub fn device_id(&self) -> DeviceID[src]

Get the ID of this Device.

pub fn line(&self) -> Line[src]

Opens a line to the Device.

pub fn disconnect(self, fault: Option<Fault>)[src]

Notify our peers we're disconnecting.

Link with another Device with the provided LinkMode. LinkModes are additive, so you can 'upgrade' a link this way.

This method is intended for static-style linking, where the topology is not expected to change. You should not link to a Device this way after linking to it through a Line.

Unlink from another Device with the provided LinkMode. LinkModes are subtractive, so you can 'downgrade' a link this way.

This method is intended for static-style linking, where the topology is not expected to change. You should not link to a Device this way after linking to it through a Line.

Link with a line. This is safer than linking directly to a Device, but a little slower.

Unlink with a line. This is safer than linking directly to a Device, but a little slower.

pub async fn watch<F, C, '_>(
    &'_ mut self,
    f: F
) -> Result<Watched<<F as Future>::Output>, Crash<C>> where
    F: Future + Unpin,
    F::Output: Debug,
    C: 'static + Any + Debug + Send
[src]

Returns the first of (with a bias towards the former):

  • The next message to be received.
  • The result of the completed future.
  • The crash of the Device.

pub async fn part_manage<'a, F, T, C>(
    __arg0: Self,
    __arg1: F
) -> Result<(Device, T), Crash<C>> where
    F: Future<Output = Result<T, C>> + Unpin,
    C: 'static + Debug + Send,
    T: Debug
[src]

Runs an async closure while monitoring for messages. Messages are handled as follows:

  • Disconnects without fault are ignored.
  • Disconnects with fault cause the Device to fault.
  • Requests to disconnect cause the Device to crash but announce a successful completion.

If the provided closure returns successfully, the result is returned along with the Device for re-use. Monitors will not be notified.

If the Device faults, either because the provided closure returned an Err variant or because a fault was propagated, announces our fault to our monitors.

pub async fn manage<F, C, T>(self, f: F) -> Result<T, Crash<C>> where
    F: Future<Output = Result<T, C>> + Unpin,
    C: 'static + Debug + Send,
    T: Debug
[src]

Like part_manage(), but in the case of successful completion of the provided future, notifies our monitors and consumes self

Trait Implementations

impl Debug for Device[src]

impl Drop for Device[src]

impl Stream for Device[src]

type Item = Message

Values yielded by the stream.

impl Unpin for Device[src]

Auto Trait Implementations

impl !RefUnwindSafe for Device

impl Send for Device

impl !Sync for Device

impl !UnwindSafe for Device

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> StreamExt for T where
    T: Stream + ?Sized
[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.