[][src]Struct tokio_simplified::IoManager

pub struct IoManager<SendType, ReceiveType = SendType> { /* fields omitted */ }

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]

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 keyhandle. 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

impl<SendType: Clone, ReceiveType: Clone> Clone for IoManager<SendType, ReceiveType>[src]

Auto Trait Implementations

impl<SendType, ReceiveType> Send for IoManager<SendType, ReceiveType> where
    ReceiveType: Send,
    SendType: Send

impl<SendType, ReceiveType> Sync for IoManager<SendType, ReceiveType> where
    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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = !

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.

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

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

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

impl<T> Erased for T