pub struct IoBoxed(/* private fields */);
Expand description
Boxed Io
object with erased filter type
Implementations§
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: Seconds)
pub fn set_disconnect_timeout(&self, timeout: Seconds)
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 read_notify(&self) -> Result<Option<()>>
pub async fn read_notify(&self) -> Result<Option<()>>
Wait until io reads any data.
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 the peer. Fully flush write buffer.
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_read_notify(&self, cx: &mut Context<'_>) -> Poll<Result<Option<()>>>
pub fn poll_read_notify(&self, cx: &mut Context<'_>) -> Poll<Result<Option<()>>>
Polls for any incoming data.
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_read_pause(&self, cx: &mut Context<'_>) -> Poll<IoStatusUpdate>
pub fn poll_read_pause(&self, cx: &mut Context<'_>) -> Poll<IoStatusUpdate>
Pause read task
Returns status updates
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
sourcepub fn poll_dispatch(&self, cx: &mut Context<'_>)
pub fn poll_dispatch(&self, cx: &mut Context<'_>)
Register dispatch task
Methods from Deref<Target = IoRef>§
sourcepub fn memory_pool(&self) -> PoolRef
pub fn memory_pool(&self) -> PoolRef
Get memory pool
sourcepub fn is_wr_backpressure(&self) -> bool
pub fn is_wr_backpressure(&self) -> bool
Check if write back-pressure is enabled
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)
pub fn want_shutdown(&self)
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 decode_item<U>(
&self,
codec: &U,
) -> Result<Decoded<<U as Decoder>::Item>, <U as Decoder>::Error>where
U: Decoder,
pub fn decode_item<U>(
&self,
codec: &U,
) -> Result<Decoded<<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>
pub fn with_write_buf<F, R>(&self, f: F) -> Result<R>
Get mut access to source write buffer
sourcepub fn with_read_buf<F, R>(&self, f: F) -> R
pub fn with_read_buf<F, R>(&self, f: F) -> R
Get mut access to source read buffer
sourcepub fn notify_dispatcher(&self)
pub fn notify_dispatcher(&self)
Wakeup dispatcher
sourcepub fn notify_timeout(&self)
pub fn notify_timeout(&self)
Wakeup dispatcher and send keep-alive error
sourcepub fn timer_handle(&self) -> TimerHandle
pub fn timer_handle(&self) -> TimerHandle
current timer handle
sourcepub fn start_timer(&self, timeout: Seconds) -> TimerHandle
pub fn start_timer(&self, timeout: Seconds) -> TimerHandle
Start timer
sourcepub fn stop_timer(&self)
pub fn stop_timer(&self)
Stop timer
sourcepub fn on_disconnect(&self) -> OnDisconnect ⓘ
pub fn on_disconnect(&self) -> OnDisconnect ⓘ
Notify when io stream get disconnected