pub struct IoRef(/* private fields */);Implementations§
Source§impl IoRef
impl IoRef
Gets the shared configuration.
Sourcepub fn is_wr_backpressure(&self) -> bool
pub fn is_wr_backpressure(&self) -> bool
Checks whether write back-pressure is enabled.
Sourcepub fn close(&self)
pub fn close(&self)
Gracefully closes the connection.
Initiates the I/O stream shutdown process.
Sourcepub fn terminate(&self)
pub fn terminate(&self)
Force-closes the connection.
The dispatcher does not wait for incomplete responses. The I/O stream is terminated without any graceful period.
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,
Encodes the item into the write buffer.
Sourcepub fn encode_slice(&self, src: &[u8]) -> Result<()>
pub fn encode_slice(&self, src: &[u8]) -> Result<()>
Encodes the slice into the write buffer.
Sourcepub fn encode_bytes<B>(&self, src: B) -> Result<()>
pub fn encode_bytes<B>(&self, src: B) -> Result<()>
Writes bytes to the write buffer.
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 send_buf(&self) -> Result<()>
pub fn send_buf(&self) -> Result<()>
Sends the write buffer to the I/O layer.
Requires the underlying runtime to implement .write();
otherwise, no action is taken.
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 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 resize_read_buf(&self, buf: &mut BytesMut)
pub fn resize_read_buf(&self, buf: &mut BytesMut)
Make sure buffer has enough free space
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