ntex_io::testing

Struct IoTest

source
pub struct IoTest { /* private fields */ }
Expand description

Async io stream

Implementations§

source§

impl IoTest

source

pub fn create() -> (IoTest, IoTest)

Create a two interconnected streams

source

pub fn is_client_dropped(&self) -> bool

source

pub fn is_server_dropped(&self) -> bool

source

pub fn is_closed(&self) -> bool

Check if channel is closed from remoote side

source

pub fn set_peer_addr(self, addr: SocketAddr) -> Self

Set peer addr

source

pub fn read_pending(&self)

Set read to Pending state

source

pub fn read_error(&self, err: Error)

Set read to error

source

pub fn write_error(&self, err: Error)

Set write error on remote side

source

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

Access read buffer.

source

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

Access remote buffer.

source

pub async fn close(&self)

Closed remote side.

source

pub fn write<T: AsRef<[u8]>>(&self, data: T)

Add extra data to the remote buffer and notify reader

source

pub fn remote_buffer_cap(&self, cap: usize)

Read any available data

source

pub fn read_any(&self) -> Bytes

Read any available data

source

pub async fn read(&self) -> Result<Bytes, Error>

Read data, if data is not available wait for it

source

pub fn poll_read_buf( &self, cx: &mut Context<'_>, buf: &mut BytesVec, ) -> Poll<Result<usize>>

source

pub fn poll_write_buf( &self, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>

Trait Implementations§

source§

impl Clone for IoTest

source§

fn clone(&self) -> Self

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 IoTest

source§

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

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

impl Drop for IoTest

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl IoStream for IoTest

source§

fn start( self, read: ReadContext, write: WriteContext, ) -> Option<Box<dyn Handle>>

Auto Trait Implementations§

§

impl Freeze for IoTest

§

impl RefUnwindSafe for IoTest

§

impl Send for IoTest

§

impl Sync for IoTest

§

impl Unpin for IoTest

§

impl UnwindSafe for IoTest

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.