[−][src]Struct carrier::conduit::Conduit
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]
F: 'static + FnMut(&Identity, M) + Clone,
M: Message + Default,
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]
F: 'static + FnMut(&Identity, M) + Clone,
M: Message + Default,
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]
F: 'static + FnMut(&Identity, Vec<u8>) + Clone,
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]
&mut self,
every: Duration,
headers: Headers,
f: F
) where
F: 'static + FnMut(&Identity, Vec<u8>) + Clone,
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]
F: 'static + FnMut(&Identity, M) + Clone,
M: Message + Default,
open a stream on a specific peer, once
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[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]
X: Generator<Yield = Again, Return = R> + Unpin,