pub trait StreamDataControl {
    const TYPE: StreamType;

    // Required methods
    fn data_size(&self) -> usize;
    fn end_of_stream(&self) -> bool;

    // Provided methods
    fn all(&self) -> Option<Vec<u8>> { ... }
    fn get(&self, range: impl RangeBounds<usize>) -> Option<Vec<u8>> { ... }
    fn set(&self, range: impl RangeBounds<usize>, value: &[u8]) { ... }
    fn replace(&self, value: &[u8]) { ... }
    fn clear(&self) { ... }
}
Expand description

Defines functions to interact with stream data

Required Associated Constants§

source

const TYPE: StreamType

Upstream or Downstream

Required Methods§

source

fn data_size(&self) -> usize

Length of this chunk of data

source

fn end_of_stream(&self) -> bool

If true, this will be the last downstream data for this context.

Provided Methods§

source

fn all(&self) -> Option<Vec<u8>>

Get all data

source

fn get(&self, range: impl RangeBounds<usize>) -> Option<Vec<u8>>

Get a range of data

source

fn set(&self, range: impl RangeBounds<usize>, value: &[u8])

Replace a range of data with value.

source

fn replace(&self, value: &[u8])

Replace the entire data with value

source

fn clear(&self)

Clear the data

Object Safety§

This trait is not object safe.

Implementors§

source§

impl StreamDataControl for DownstreamData

source§

const TYPE: StreamType = StreamType::Downstream

source§

impl StreamDataControl for UpstreamData

source§

const TYPE: StreamType = StreamType::Upstream