[][src]Struct tokio_simplified::IoManagerBuilder

pub struct IoManagerBuilder<SinkType, StreamType, BF = fn(_: <StreamType as Stream>::Item, _: &mut IoWriter<<SinkType as Sink>::SinkItem>) -> Option<<StreamType as Stream>::Item>, BEH = fn(_: <StreamType as Stream>::Error)> where
    SinkType: Sink,
    StreamType: Stream,
    BF: FnMut(<StreamType as Stream>::Item, &mut IoWriter<<SinkType as Sink>::SinkItem>) -> Option<<StreamType as Stream>::Item> + Send + 'static,
    BEH: FnMut(<StreamType as Stream>::Error) + Send + 'static, 
{ /* fields omitted */ }

A builder for IoManager, and the only way to build one since the constructors have been deleted.

Methods

impl<SinkType, StreamType> IoManagerBuilder<SinkType, StreamType> where
    SinkType: Sink + Send + 'static,
    StreamType: Stream + Send + 'static,
    <StreamType as Stream>::Item: Send + Clone + 'static,
    <StreamType as Stream>::Error: Send,
    <SinkType as Sink>::SinkItem: Send + 'static, 
[src]

pub fn new(
    sink: SinkType,
    stream: StreamType
) -> IoManagerBuilder<SinkType, StreamType, fn(_: <StreamType as Stream>::Item, _: &mut IoWriter<<SinkType as Sink>::SinkItem>) -> Option<<StreamType as Stream>::Item>, fn(_: <StreamType as Stream>::Error)>
[src]

Creates a builder for IoManager.

impl<SinkType, StreamType, FilterType, ErrorHandlerType> IoManagerBuilder<SinkType, StreamType, FilterType, ErrorHandlerType> where
    SinkType: Sink + Send + 'static,
    StreamType: Stream + Send + 'static,
    <StreamType as Stream>::Item: Send + Clone + 'static,
    <StreamType as Stream>::Error: Send,
    <SinkType as Sink>::SinkItem: Send + 'static,
    FilterType: Filter<<SinkType as Sink>::SinkItem, <StreamType as Stream>::Item>,
    ErrorHandlerType: ErrorHandler<<StreamType as Stream>::Error>, 
[src]

pub fn with_filter<NewFilterType>(
    self,
    filter: NewFilterType
) -> IoManagerBuilder<SinkType, StreamType, NewFilterType, ErrorHandlerType> where
    NewFilterType: Filter<<SinkType as Sink>::SinkItem, <StreamType as Stream>::Item>, 
[src]

Adds a filter to the IoManager builder. Filters are static in this library. If you need to be able to change the filter without droping the sink and steram passed to this instance, you should probably use Box to encapsulate your filter, and then whatever you need to make it all thread safe for when you'll need to modify it. Type inference should still work, which is nice.

pub fn with_error_handler<NewErrorHandlerType>(
    self,
    handler: NewErrorHandlerType
) -> IoManagerBuilder<SinkType, StreamType, FilterType, NewErrorHandlerType> where
    NewErrorHandlerType: ErrorHandler<<StreamType as Stream>::Error>, 
[src]

Similar to with_filter, only for error handling. Tip: if you want to be able to catch end of streams with this API, you may want your Codec to implement decode_eof() and throw an error at the last moment, such as this:

fn decode_eof(&mut self, buf: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
    let decode = self.decode(buf);
    match decode {
        Ok(None) => Err(std::io::Error::from(std::io::ErrorKind::ConnectionAborted)),
        _ => decode,
    }
}

pub fn build(self) -> IoManager<SinkType::SinkItem, StreamType::Item>[src]

Auto Trait Implementations

impl<SinkType, StreamType, BF, BEH> Send for IoManagerBuilder<SinkType, StreamType, BF, BEH> where
    SinkType: Send,
    StreamType: Send

impl<SinkType, StreamType, BF, BEH> Sync for IoManagerBuilder<SinkType, StreamType, BF, BEH> where
    BEH: Sync,
    BF: Sync,
    SinkType: Sync,
    StreamType: Sync

impl<SinkType, StreamType, BF, BEH> Unpin for IoManagerBuilder<SinkType, StreamType, BF, BEH> where
    BEH: Unpin,
    BF: Unpin,
    SinkType: Unpin,
    StreamType: Unpin

impl<SinkType, StreamType, BF, BEH> UnwindSafe for IoManagerBuilder<SinkType, StreamType, BF, BEH> where
    BEH: UnwindSafe,
    BF: UnwindSafe,
    SinkType: UnwindSafe,
    StreamType: UnwindSafe

impl<SinkType, StreamType, BF, BEH> RefUnwindSafe for IoManagerBuilder<SinkType, StreamType, BF, BEH> where
    BEH: RefUnwindSafe,
    BF: RefUnwindSafe,
    SinkType: RefUnwindSafe,
    StreamType: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

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

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