[][src]Struct carrier::conduit::Conduit

pub struct Conduit { /* fields omitted */ }

A conduit is a combined subscribe+connect client that subscribes to all devices on a shadow and streams data from them. For convenience, most common functionality is implemented into this struct, and users only need to implement handling the data.

Methods

impl Conduit[src]

pub fn new(poll: Poll, config: Config) -> Task<Result<Self, Error>>[src]

create a new conduit as a future. it will subscribe to the shadow address and maintain a connection to all peers on it

pub fn schedule<F, M>(&mut self, every: Duration, headers: Headers, f: F) where
    F: 'static + FnMut(&Identity, M) + Clone,
    M: Message + Default
[src]

schedule opening a stream on all devices with the given headers

every is the restart delay, that means if a stream is closed, it wont be restarted before delay expired. You can use this to poll a get endpoint.

pub fn schedule_small<F, M>(&mut self, every: Duration, headers: Headers, f: F) where
    F: 'static + FnMut(&Identity, M) + Clone,
    M: Message + Default
[src]

schedule opening a small stream on all devices with the given headers

decodes each datagram as message without size prefix, like old carrier clients did

pub fn schedule_raw<F>(&mut self, every: Duration, headers: Headers, f: F) where
    F: 'static + FnMut(&Identity, Vec<u8>) + Clone
[src]

schedule opening a raw stream on all devices with the given headers

gives you all datagrams as bytes

pub fn schedule_null_terminated<F>(
    &mut self,
    every: Duration,
    headers: Headers,
    f: F
) where
    F: 'static + FnMut(&Identity, Vec<u8>) + Clone
[src]

schedule opening a stream where each message is terminated with \0

it is memory unbounded, meaning an infinite stream will OOM your system

this stream type was a bad idea and you should only use it if you have legacy devices out there that need it

pub fn call<F, M>(&mut self, target: Identity, headers: Headers, f: F) where
    F: 'static + FnMut(&Identity, M) + Clone,
    M: Message + Default
[src]

open a stream on a specific peer, once

Trait Implementations

Auto Trait Implementations

impl !Send for Conduit

impl !Sync for Conduit

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> Same for T

type Output = T

Should always be Self

impl<R, X> Future for X where
    X: Generator<Yield = Again, Return = R> + Unpin
[src]