pub struct StreamFixtureSink<'storage> { /* private fields */ }Expand description
Caller-buffered deterministic sink with configurable short writes.
Implementations§
Source§impl<'storage> StreamFixtureSink<'storage>
impl<'storage> StreamFixtureSink<'storage>
Sourcepub fn new(
output: &'storage mut [u8],
max_write_bytes: usize,
) -> Result<Self, StreamFixtureError>
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.
Sourcepub const fn with_fault_at_write(
self,
write: usize,
) -> Result<Self, StreamFixtureError>
pub const fn with_fault_at_write( self, write: usize, ) -> Result<Self, StreamFixtureError>
Injects a sink failure at one one-based write attempt.
Sourcepub const fn is_committed(&self) -> bool
pub const fn is_committed(&self) -> bool
Reports whether the successful stream was committed.
Sourcepub const fn aborted_with(&self) -> Option<StreamPartialState>
pub const fn aborted_with(&self) -> Option<StreamPartialState>
Returns the last incomplete-state abort classification.
Trait Implementations§
Source§impl AsyncStreamSink for StreamFixtureSink<'_>
impl AsyncStreamSink for StreamFixtureSink<'_>
Source§type Error = StreamFixtureError
type Error = StreamFixtureError
Sink-specific payload-free failure.
Source§async fn write_chunk<'operation>(
&'operation mut self,
input: &'operation [u8],
) -> Result<usize, Self::Error>
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>
async fn commit(&mut self) -> Result<(), Self::Error>
Commits a successfully validated stream in a
Send future.Source§fn abort(&mut self, partial: StreamPartialState)
fn abort(&mut self, partial: StreamPartialState)
Synchronously aborts on error or future cancellation.
Source§impl BlockingStreamSink for StreamFixtureSink<'_>
impl BlockingStreamSink for StreamFixtureSink<'_>
Source§type Error = StreamFixtureError
type Error = StreamFixtureError
Sink-specific payload-free failure.
Source§fn write_chunk(&mut self, input: &[u8]) -> Result<usize, Self::Error>
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 abort(&mut self, partial: StreamPartialState)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> LocalAsyncStreamSink for Twhere
T: AsyncStreamSink,
impl<T> LocalAsyncStreamSink for Twhere
T: AsyncStreamSink,
Source§type Error = <T as AsyncStreamSink>::Error
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>
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>
async fn commit_local( &mut self, ) -> Result<(), <T as LocalAsyncStreamSink>::Error>
Commits a successfully validated stream.
Source§fn abort_local(&mut self, partial: StreamPartialState)
fn abort_local(&mut self, partial: StreamPartialState)
Synchronously aborts on error or future cancellation.