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) { ... }
fn write_upstream(&self, data: &[u8]) { ... }
fn write_downstream(&self, data: &[u8]) { ... }
}
Expand description
Defines functions to interact with stream data
Required Associated Constants§
Sourceconst TYPE: StreamType
const TYPE: StreamType
Upstream or Downstream
Required Methods§
Sourcefn end_of_stream(&self) -> bool
fn end_of_stream(&self) -> bool
If true, this will be the last downstream data for this context.
Provided Methods§
Sourcefn set(&self, range: impl RangeBounds<usize>, value: &[u8])
fn set(&self, range: impl RangeBounds<usize>, value: &[u8])
Replace a range of data with value
.
Sourcefn write_upstream(&self, data: &[u8])
fn write_upstream(&self, data: &[u8])
Writes data directly upstream, should be called from downstream context.
Sourcefn write_downstream(&self, data: &[u8])
fn write_downstream(&self, data: &[u8])
Writes data directly downstream, should be called from upstream context.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.