pub struct IoTest { /* private fields */ }Expand description
Async io stream
Implementations
sourceimpl IoTest
impl IoTest
pub fn is_client_dropped(&self) -> bool
pub fn is_server_dropped(&self) -> bool
sourcepub fn set_peer_addr(self, addr: SocketAddr) -> Self
pub fn set_peer_addr(self, addr: SocketAddr) -> Self
Set peer addr
sourcepub fn read_pending(&self)
pub fn read_pending(&self)
Set read to Pending state
sourcepub fn read_error(&self, err: Error)
pub fn read_error(&self, err: Error)
Set read to error
sourcepub fn write_error(&self, err: Error)
pub fn write_error(&self, err: Error)
Set write error on remote side
sourcepub fn local_buffer<F, R>(&self, f: F) -> R where
F: FnOnce(&mut BytesVec) -> R,
pub fn local_buffer<F, R>(&self, f: F) -> R where
F: FnOnce(&mut BytesVec) -> R,
Access read buffer.
sourcepub fn remote_buffer<F, R>(&self, f: F) -> R where
F: FnOnce(&mut BytesVec) -> R,
pub fn remote_buffer<F, R>(&self, f: F) -> R where
F: FnOnce(&mut BytesVec) -> R,
Access remote buffer.
sourcepub fn write<T: AsRef<[u8]>>(&self, data: T)
pub fn write<T: AsRef<[u8]>>(&self, data: T)
Add extra data to the remote buffer and notify reader
sourcepub fn remote_buffer_cap(&self, cap: usize)
pub fn remote_buffer_cap(&self, cap: usize)
Read any available data
sourcepub async fn read(&self) -> Result<Bytes, Error>
pub async fn read(&self) -> Result<Bytes, Error>
Read data, if data is not available wait for it
pub fn poll_read_buf(
&self,
cx: &mut Context<'_>,
buf: &mut BytesVec
) -> Poll<Result<usize>>
pub fn poll_write_buf(
&self,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
Trait Implementations
sourceimpl IoStream for IoTest
impl IoStream for IoTest
fn start(
self,
read: ReadContext,
write: WriteContext
) -> Option<Box<dyn Handle>>
Auto Trait Implementations
impl !RefUnwindSafe for IoTest
impl !Send for IoTest
impl !Sync for IoTest
impl Unpin for IoTest
impl !UnwindSafe for IoTest
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more