[−][src]Struct tokio_simplified::IoManager
A simplified interface to interact with tokio's streams and sinks.
Allows easy subscription to the stream's frames, and easy sending to the sink.
Methods
impl<SendType, ReceiveType> IoManager<SendType, ReceiveType>
[src]
pub fn subscribe_mpsc_sender(&self, subscriber: Sender<ReceiveType>) -> u32
[src]
subscriber
will receive any data polled from the internal stream.
pub fn on_receive<F>(&self, callback: F) -> u32 where
F: FnMut(ReceiveType) -> Result<(), ()> + Send + 'static,
ReceiveType: Send + 'static,
[src]
F: FnMut(ReceiveType) -> Result<(), ()> + Send + 'static,
ReceiveType: Send + 'static,
callback
will be called for each frame
polled from the internal stream.
pub fn extract_callback(&self, key: &u32) -> Option<Sender<ReceiveType>>
[src]
Removes the callback with key
handle. key
should be a value returned by either
on_receive()
or subscribe_mpsc_sender()
.
Returns the mpsc::Sender
that used to be notified upon new frames, just in case.
pub fn get_writer(&self) -> IoWriter<SendType>
[src]
Returns an IoWriter
that will forward data to the associated tokio sink.
Trait Implementations
Auto Trait Implementations
impl<SendType, ReceiveType> Send for IoManager<SendType, ReceiveType> where
ReceiveType: Send,
SendType: Send,
ReceiveType: Send,
SendType: Send,
impl<SendType, ReceiveType> Sync for IoManager<SendType, ReceiveType> where
ReceiveType: Send,
SendType: Send,
ReceiveType: Send,
SendType: Send,
impl<SendType, ReceiveType> Unpin for IoManager<SendType, ReceiveType>
impl<SendType, ReceiveType = SendType> !UnwindSafe for IoManager<SendType, ReceiveType>
impl<SendType, ReceiveType = SendType> !RefUnwindSafe for IoManager<SendType, ReceiveType>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,