Skip to main content

StreamFixtureSink

Struct StreamFixtureSink 

Source
pub struct StreamFixtureSink<'storage> { /* private fields */ }
Expand description

Caller-buffered deterministic sink with configurable short writes.

Implementations§

Source§

impl<'storage> StreamFixtureSink<'storage>

Source

pub fn new( output: &'storage mut [u8], max_write_bytes: usize, ) -> Result<Self, StreamFixtureError>

Creates a sink and clears all caller storage before first use.

Source

pub const fn with_fault_at_write( self, write: usize, ) -> Result<Self, StreamFixtureError>

Injects a sink failure at one one-based write attempt.

Source

pub fn bytes(&self) -> &[u8]

Returns initialized sink bytes.

Source

pub const fn writes(&self) -> usize

Returns deterministic sink write count.

Source

pub const fn is_committed(&self) -> bool

Reports whether the successful stream was committed.

Source

pub const fn aborted_with(&self) -> Option<StreamPartialState>

Returns the last incomplete-state abort classification.

Trait Implementations§

Source§

impl AsyncStreamSink for StreamFixtureSink<'_>

Source§

type Error = StreamFixtureError

Sink-specific payload-free failure.
Source§

async fn write_chunk<'operation>( &'operation mut self, input: &'operation [u8], ) -> Result<usize, Self::Error>

Accepts some or all bytes in a Send future.
Source§

async fn commit(&mut self) -> Result<(), Self::Error>

Commits a successfully validated stream in a Send future.
Source§

fn abort(&mut self, partial: StreamPartialState)

Synchronously aborts on error or future cancellation.
Source§

impl BlockingStreamSink for StreamFixtureSink<'_>

Source§

type Error = StreamFixtureError

Sink-specific payload-free failure.
Source§

fn write_chunk(&mut self, input: &[u8]) -> Result<usize, Self::Error>

Accepts some or all bytes. A zero result is a bounded no-progress event.
Source§

fn commit(&mut self) -> Result<(), Self::Error>

Commits a successfully validated stream.
Source§

fn abort(&mut self, partial: StreamPartialState)

Aborts an incomplete stream according to its recorded partial state.

Auto Trait Implementations§

§

impl<'storage> !UnwindSafe for StreamFixtureSink<'storage>

§

impl<'storage> Freeze for StreamFixtureSink<'storage>

§

impl<'storage> RefUnwindSafe for StreamFixtureSink<'storage>

§

impl<'storage> Send for StreamFixtureSink<'storage>

§

impl<'storage> Sync for StreamFixtureSink<'storage>

§

impl<'storage> Unpin for StreamFixtureSink<'storage>

§

impl<'storage> UnsafeUnpin for StreamFixtureSink<'storage>

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> LocalAsyncStreamSink for T
where T: AsyncStreamSink,

Source§

type Error = <T as AsyncStreamSink>::Error

Sink-specific payload-free failure.
Source§

async fn write_chunk_local<'operation>( &'operation mut self, input: &'operation [u8], ) -> Result<usize, <T as LocalAsyncStreamSink>::Error>

Accepts some or all bytes without retaining input after completion.
Source§

async fn commit_local( &mut self, ) -> Result<(), <T as LocalAsyncStreamSink>::Error>

Commits a successfully validated stream.
Source§

fn abort_local(&mut self, partial: StreamPartialState)

Synchronously aborts on error or future cancellation.
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.