[−][src]Struct tokio_simplified::IoManagerBuilder
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]
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,
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]
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)>
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]
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>,
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]
self,
filter: NewFilterType
) -> IoManagerBuilder<SinkType, StreamType, NewFilterType, ErrorHandlerType> where
NewFilterType: Filter<<SinkType as Sink>::SinkItem, <StreamType as Stream>::Item>,
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]
self,
handler: NewErrorHandlerType
) -> IoManagerBuilder<SinkType, StreamType, FilterType, NewErrorHandlerType> where
NewErrorHandlerType: ErrorHandler<<StreamType as Stream>::Error>,
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,
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,
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,
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,
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,
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]
U: From<T>,
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,