Skip to main content

Pending

Struct Pending 

Source
pub struct Pending { /* private fields */ }
Available on crate features test-util only.
Expand description

A Read and Write that never completes any reads or writes.

Intended for simple tests and examples that need a never-completing stream.

Implementations§

Source§

impl Pending

Source

pub fn builder() -> PendingBuilder

Starts building a new PendingStream.

Source

pub fn new() -> Self

Creates a new PendingStream with the default configuration.

Source

pub async fn read_at_most_into( &mut self, _len: usize, _into: BytesBuf, ) -> Result<(usize, BytesBuf), Infallible>

Starts a read operation that never completes.

§Errors

This call never fails (because it never completes).

Source

pub async fn read_more_into( &mut self, _into: BytesBuf, ) -> Result<(usize, BytesBuf), Infallible>

Starts a read operation that never completes.

§Errors

This call never fails (because it never completes).

Source

pub async fn read_any(&mut self) -> Result<BytesBuf, Infallible>

Starts a read operation that never completes.

§Errors

This call never fails (because it never completes).

Source

pub async fn write(&mut self, _sequence: BytesView) -> Result<(), Infallible>

Starts a write operation that never completes.

§Errors

This call never fails (because it never completes).

Source

pub fn memory(&self) -> impl MemoryShared

Returns the memory provider that was configured in the builder.

Source

pub fn reserve(&self, min_bytes: usize) -> BytesBuf

Reserves at least min_bytes bytes of memory capacity.

Returns an empty BytesBuf that can be used to fill the reserved memory with data.

The memory provider may provide more memory than requested.

The memory reservation request will always be fulfilled, obtaining more memory from the operating system if necessary.

§Zero-sized reservations

Reserving zero bytes of memory is a valid operation and will return a BytesBuf with zero or more bytes of capacity.

§Panics

May panic if the operating system runs out of memory.

Trait Implementations§

Source§

impl Debug for Pending

Source§

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

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

impl Default for Pending

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl HasMemory for Pending

Source§

fn memory(&self) -> impl MemoryShared

Returns a sharing-compatible memory provider. Read more
Source§

impl Memory for Pending

Source§

fn reserve(&self, min_bytes: usize) -> BytesBuf

Reserves at least min_bytes bytes of memory capacity. Read more
Source§

impl Read for Pending

Source§

type Error = Infallible

Type used to signal errors by the implementation of this trait.
Source§

async fn read_at_most_into( &mut self, len: usize, into: BytesBuf, ) -> Result<(usize, BytesBuf), Infallible>

Reads at most len bytes into the provided buffer. Read more
Source§

async fn read_more_into( &mut self, into: BytesBuf, ) -> Result<(usize, BytesBuf), Infallible>

Reads an unspecified number of bytes into the provided buffer. Read more
Source§

async fn read_any(&mut self) -> Result<BytesBuf, Infallible>

Reads an unspecified number of bytes as a new buffer. Read more
Source§

impl Write for Pending

Source§

type Error = Infallible

Type used to signal errors by the implementation of this trait.
Source§

async fn write(&mut self, data: BytesView) -> Result<(), Infallible>

Writes the provided byte sequence. Read more

Auto Trait Implementations§

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> 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> ReadExt for T
where T: Read,

Source§

async fn read_at_most(&mut self, len: usize) -> Result<BytesView, Error>

Reads at most len bytes into a new buffer. Read more
Source§

async fn read_exactly(&mut self, len: usize) -> Result<BytesView, Error>

Reads exactly len bytes into a new buffer. Read more
Source§

async fn read_at_most_while<F>( &mut self, len: usize, inspect_fn: F, ) -> Result<(BytesView, BytesBuf), Error>

Conditionally reads at most len bytes into a new buffer. Read more
Source§

async fn read_at_most_into_while<F>( &mut self, len: usize, into: BytesBuf, inspect_fn: F, ) -> Result<(BytesView, BytesBuf), Error>

Conditionally reads at most len bytes into the provided buffer. Read more
Source§

fn into_futures_stream(self) -> Pin<Box<ReadAsFuturesStream<T>>>

Available on crate feature futures-stream only.
Transforms the Read into a futures::Stream. 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.
Source§

impl<T> WriteExt for T
where T: Write,

Source§

async fn prepare_and_write<F, E>( &mut self, min_capacity: usize, prepare_fn: F, ) -> Result<(), Error>
where F: FnOnce(BytesBuf) -> Result<BytesView, E> + Send, E: Error + Send + Sync + 'static,

Provides a memory buffer to a callback, then writes the contents. Read more
Source§

impl<T> MemoryShared for T
where T: Memory + Send + Sync + 'static,