[−][src]Struct async_backplane::Device
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.
pub fn link(&self, other: &Device, mode: LinkMode)
[src]
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.
pub fn unlink(&self, other: &Device, mode: LinkMode)
[src]
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.
pub fn link_line(&self, other: Line, mode: LinkMode) -> Result<(), LinkError>
[src]
Link with a line. This is safer than linking directly to a Device, but a little slower.
pub fn unlink_line(&self, other: &Line, mode: LinkMode)
[src]
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]
&'_ mut self,
f: F
) -> Result<Watched<<F as Future>::Output>, Crash<C>> where
F: Future + Unpin,
F::Output: Debug,
C: 'static + Any + Debug + Send,
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]
__arg0: Self,
__arg1: F
) -> Result<(Device, T), Crash<C>> where
F: Future<Output = Result<T, C>> + Unpin,
C: 'static + Debug + Send,
T: Debug,
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]
F: Future<Output = Result<T, C>> + Unpin,
C: 'static + Debug + Send,
T: Debug,
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.
fn poll_next(
self: Pin<&mut Self>,
ctx: &mut Context
) -> Poll<Option<Self::Item>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context
) -> Poll<Option<Self::Item>>
fn size_hint(&self) -> (usize, Option<usize>)
[src]
impl Unpin for Device
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StreamExt for T where
T: Stream + ?Sized,
[src]
T: Stream + ?Sized,
fn next(&mut self) -> NextFuture<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn collect<C>(self) -> CollectFuture<Self, C> where
C: Default + Extend<Self::Item>,
[src]
C: Default + Extend<Self::Item>,
fn try_collect<T, C>(self) -> TryCollectFuture<Self, C> where
C: Default + Extend<T>,
Self::Item: Result,
<Self::Item as Result>::Ok == T,
[src]
C: Default + Extend<T>,
Self::Item: Result,
<Self::Item as Result>::Ok == T,
fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, F, B> where
F: FnMut(B, Self::Item) -> B,
[src]
F: FnMut(B, Self::Item) -> B,
fn try_fold<T, E, F, B>(&mut self, init: B, f: F) -> TryFoldFuture<Self, F, B> where
F: FnMut(B, T) -> Result<B, E>,
Self: Unpin,
Self::Item: Result,
<Self::Item as Result>::Ok == T,
<Self::Item as Result>::Err == E,
[src]
F: FnMut(B, T) -> Result<B, E>,
Self: Unpin,
Self::Item: Result,
<Self::Item as Result>::Ok == T,
<Self::Item as Result>::Err == E,
fn boxed(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'static + Send>> where
Self: Send + 'static,
[src]
Self: Send + 'static,
fn boxed_local(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'static>> where
Self: 'static,
[src]
Self: 'static,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,