pub struct IoBoxed(_);
Expand description
Boxed Io
object with erased filter type
Methods from Deref<Target = Io<Sealed>>§
sourcepub fn set_memory_pool(&self, pool: PoolRef)
pub fn set_memory_pool(&self, pool: PoolRef)
Set memory pool
sourcepub fn set_disconnect_timeout(&self, timeout: Millis)
pub fn set_disconnect_timeout(&self, timeout: Millis)
Set io disconnect timeout in millis
sourcepub async fn recv<U>(
&self,
codec: &U
) -> Result<Option<U::Item>, Either<U::Error, Error>>where
U: Decoder,
pub async fn recv<U>(
&self,
codec: &U
) -> Result<Option<U::Item>, Either<U::Error, Error>>where
U: Decoder,
Read incoming io stream and decode codec item.
sourcepub async fn read_ready(&self) -> Result<Option<()>>
pub async fn read_ready(&self) -> Result<Option<()>>
Wait until read becomes ready.
sourcepub async fn send<U>(
&self,
item: U::Item,
codec: &U
) -> Result<(), Either<U::Error, Error>>where
U: Encoder,
pub async fn send<U>(
&self,
item: U::Item,
codec: &U
) -> Result<(), Either<U::Error, Error>>where
U: Encoder,
Encode item, send to a peer
sourcepub async fn flush(&self, full: bool) -> Result<()>
pub async fn flush(&self, full: bool) -> Result<()>
Wake write task and instruct to flush data.
This is async version of .poll_flush() method.
sourcepub fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll<Result<Option<()>>>
pub fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll<Result<Option<()>>>
Polls for read readiness.
If the io stream is not currently ready for reading, this method will store a clone of the Waker from the provided Context. When the io stream becomes ready for reading, Waker::wake will be called on the waker.
Return value The function returns:
Poll::Pending
if the io stream is not ready for reading.
Poll::Ready(Ok(Some(()))))
if the io stream is ready for reading.
Poll::Ready(Ok(None))
if io stream is disconnected
Some(Poll::Ready(Err(e)))
if an error is encountered.
sourcepub fn poll_recv<U>(
&self,
codec: &U,
cx: &mut Context<'_>
) -> Poll<Result<U::Item, RecvError<U>>>where
U: Decoder,
pub fn poll_recv<U>(
&self,
codec: &U,
cx: &mut Context<'_>
) -> Poll<Result<U::Item, RecvError<U>>>where
U: Decoder,
Decode codec item from incoming bytes stream.
Wake read task and request to read more data if data is not enough for decoding. If error get returned this method does not register waker for later wake up action.
sourcepub fn poll_flush(&self, cx: &mut Context<'_>, full: bool) -> Poll<Result<()>>
pub fn poll_flush(&self, cx: &mut Context<'_>, full: bool) -> Poll<Result<()>>
Wake write task and instruct to flush data.
If full
is true then wake up dispatcher when all data is flushed
otherwise wake up when size of write buffer is lower than
buffer max size.
sourcepub fn poll_shutdown(&self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_shutdown(&self, cx: &mut Context<'_>) -> Poll<Result<()>>
Gracefully shutdown io stream
sourcepub fn poll_status_update(&self, cx: &mut Context<'_>) -> Poll<IoStatusUpdate>
pub fn poll_status_update(&self, cx: &mut Context<'_>) -> Poll<IoStatusUpdate>
Wait for status updates
Methods from Deref<Target = IoRef>§
sourcepub fn memory_pool(&self) -> PoolRef
pub fn memory_pool(&self) -> PoolRef
Get memory pool
sourcepub fn close(&self)
pub fn close(&self)
Gracefully close connection
Notify dispatcher and initiate io stream shutdown process.
sourcepub fn force_close(&self)
pub fn force_close(&self)
Force close connection
Dispatcher does not wait for uncompleted responses. Io stream get terminated without any graceful period.
sourcepub fn want_shutdown(&self, err: Option<Error>)
pub fn want_shutdown(&self, err: Option<Error>)
Gracefully shutdown io stream
sourcepub fn encode<U>(
&self,
item: U::Item,
codec: &U
) -> Result<(), <U as Encoder>::Error>where
U: Encoder,
pub fn encode<U>(
&self,
item: U::Item,
codec: &U
) -> Result<(), <U as Encoder>::Error>where
U: Encoder,
Encode and write item to a buffer and wake up write task
sourcepub fn decode<U>(
&self,
codec: &U
) -> Result<Option<<U as Decoder>::Item>, <U as Decoder>::Error>where
U: Decoder,
pub fn decode<U>(
&self,
codec: &U
) -> Result<Option<<U as Decoder>::Item>, <U as Decoder>::Error>where
U: Decoder,
Attempts to decode a frame from the read buffer
sourcepub fn with_write_buf<F, R>(&self, f: F) -> Result<R, Error>where
F: FnOnce(&mut BytesVec) -> R,
pub fn with_write_buf<F, R>(&self, f: F) -> Result<R, Error>where
F: FnOnce(&mut BytesVec) -> R,
Get mut access to write buffer
sourcepub fn with_read_buf<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&mut BytesVec) -> R,
pub fn with_read_buf<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&mut BytesVec) -> R,
Get mut access to read buffer
sourcepub fn start_keepalive_timer(&self, timeout: Duration)
pub fn start_keepalive_timer(&self, timeout: Duration)
Start keep-alive timer
sourcepub fn stop_keepalive_timer(&self)
pub fn stop_keepalive_timer(&self)
Stop keep-alive timer
sourcepub fn on_disconnect(&self) -> OnDisconnect ⓘ
pub fn on_disconnect(&self) -> OnDisconnect ⓘ
Notify when io stream get disconnected