ntex_io

Struct IoRef

source
pub struct IoRef(/* private fields */);

Implementations§

source§

impl IoRef

source

pub fn memory_pool(&self) -> PoolRef

Get memory pool

source

pub fn is_closed(&self) -> bool

Check if io stream is closed

source

pub fn is_wr_backpressure(&self) -> bool

Check if write back-pressure is enabled

source

pub fn wake(&self)

Wake dispatcher task

source

pub fn close(&self)

Gracefully close connection

Notify dispatcher and initiate io stream shutdown process.

source

pub fn force_close(&self)

Force close connection

Dispatcher does not wait for uncompleted responses. Io stream get terminated without any graceful period.

source

pub fn want_shutdown(&self)

Gracefully shutdown io stream

source

pub fn query<T: 'static>(&self) -> QueryItem<T>

Query filter specific data

source

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

source

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

source

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

source

pub fn write(&self, src: &[u8]) -> Result<()>

Write bytes to a buffer and wake up write task

source

pub fn with_buf<F, R>(&self, f: F) -> Result<R>
where F: FnOnce(&WriteBuf<'_>) -> R,

Get access to write buffer

source

pub fn with_write_buf<F, R>(&self, f: F) -> Result<R>
where F: FnOnce(&mut BytesVec) -> R,

Get mut access to source write buffer

source

pub fn with_read_buf<F, R>(&self, f: F) -> R
where F: FnOnce(&mut BytesVec) -> R,

Get mut access to source read buffer

source

pub fn notify_dispatcher(&self)

Wakeup dispatcher

source

pub fn notify_timeout(&self)

Wakeup dispatcher and send keep-alive error

source

pub fn timer_handle(&self) -> TimerHandle

current timer handle

source

pub fn start_timer(&self, timeout: Seconds) -> TimerHandle

Start timer

source

pub fn stop_timer(&self)

Stop timer

source

pub fn tag(&self) -> &'static str

Get tag

source

pub fn set_tag(&self, tag: &'static str)

Set tag

source

pub fn on_disconnect(&self) -> OnDisconnect

Notify when io stream get disconnected

Trait Implementations§

source§

impl<F> AsRef<IoRef> for Io<F>

source§

fn as_ref(&self) -> &IoRef

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for IoRef

source§

fn clone(&self) -> IoRef

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IoRef

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for IoRef

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for IoRef

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for IoRef

Auto Trait Implementations§

§

impl Freeze for IoRef

§

impl !RefUnwindSafe for IoRef

§

impl !Send for IoRef

§

impl !Sync for IoRef

§

impl Unpin for IoRef

§

impl !UnwindSafe for IoRef

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.