Struct sgdata::SGData[][src]

pub struct SGData(_);
Expand description

Scattered, gathered, immutable, arc-ed data

Allows zero-copy processing of streamed data, read into fixed-size buffers. Especially useful for high-performance, parallel data processing.

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.

Implementations

Total len of all parts

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.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.