Struct sgdata::SGData
[−]
[src]
pub struct SGData(_);
Scattered, gathered, immutable, arc-ed data
A piece of data potentially scattered between multiple parts, which themselves might be slices of shared-ownership underlying data.
SGData
is essentially semantic wrapper over Vec<ArcRef<Vec<u8>, [u8]>>
For illustration:
frames: [ Buf ][ Buf ][ Buf ][ Buf ]
edges: | | | | |
| | | | |
\ /\ / \ / \ /\ /\ / \ /
\ / || || | | \ / \ / \ /
sgdata parts: C1[0] C1[1] C2[0] C3[0] C3[1] C3[2] C4[0]
Arbitrary-sized data is being read into frames
and edges between
logical parts are being found. Then sgdata
objects are created,
aggregating parts of frames
while holding reference-counted shared
ownership over frames
.
Methods
impl SGData
[src]
fn empty() -> Self
[src]
fn from_single(v: Vec<u8>) -> Self
[src]
fn from_vec(v: Vec<ArcRef<Vec<u8>, [u8]>>) -> Self
[src]
fn from_many(v: Vec<Vec<u8>>) -> Self
[src]
fn len(&self) -> usize
[src]
Total len of all parts
fn is_empty(&self) -> bool
[src]
fn as_parts(&self) -> &[ArcRef<Vec<u8>, [u8]>]
[src]
fn as_vec(&self) -> &Vec<ArcRef<Vec<u8>, [u8]>>
[src]
fn as_vec_mut(&mut self) -> &mut Vec<ArcRef<Vec<u8>, [u8]>>
[src]
fn push_vec(&mut self, v: Vec<u8>)
[src]
fn push_arcref(&mut self, arcref: ArcRef<Vec<u8>, [u8]>)
[src]
fn to_linear(&self) -> ArcRef<Vec<u8>, [u8]>
[src]
Convert to linear (single vector) form
If self
is empty or already contains only one piece,
this is cheap.
If self
is scattered between many pices, this requires
copying all the data into a new, big chunk.
fn to_linear_vec(self) -> Vec<u8>
[src]
Trait Implementations
impl Debug for SGData
[src]
impl PartialEq for SGData
[src]
fn eq(&self, __arg_0: &SGData) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SGData) -> bool
[src]
This method tests for !=
.