[][src]Struct rexsgdata::SgData

pub struct SgData<O> where
    O: Clone
{ /* fields omitted */ }

High Level wrapper for multiple data representation methods. It has 2 fields:

  1. data - a vector of heterogeneous data representations.

  2. observers - An observer is some generic type that implements Clone.

    An observer can be explicitly associated with an sg-data By a call to the method observe() Or by the creation of a shallow copy of an observed sg-data, I.e. a call to the method copy_masked().

    An observer is used as a helper to ensure that an sg-data can safely be dropped, Since an Sg-Data is dropped with it's observers, they will not access it.

Methods

impl<O> SgData<O> where
    O: Clone
[src]

pub fn with_capacity(capcity: usize) -> Self[src]

Create an SgData with specified capacity

pub fn iter(&self) -> impl Iterator<Item = &[u8]>[src]

Iterates over all the underlying byte slices of this SgData.

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut [u8]>[src]

Iterates over all the mutable underlying byte slices of this SgData.

pub fn iter_masked<'a>(
    &'a self,
    mask: &'a Range<usize>
) -> impl Iterator<Item = &[u8]> + 'a
[src]

Given a mask iterates over slices that are visible after masking

pub fn size(&self) -> usize[src]

Returns number of elements in the underlying object, NOT the total number of bytes.

pub fn capacity(&self) -> usize[src]

Returns the total number of bytes in the underlying object.

pub fn is_empty(&self) -> bool[src]

Checks this SgData for containing any byte slice

pub unsafe fn clone_into(self, iovec: *mut iovec, count: c_int) -> Self[src]

Deprecated since 0.2.0:

use drain_into() instead

pub unsafe fn drain_into(self, iovec: *const iovec, count: usize) -> Self[src]

Moves the data contained in this SgData instance into iovec. Consumes this instance and creates a new one, based on the buffers described by iovec and count.

observers are not drained since the data is moved to a new sg-list

pub fn to_vec(&self) -> Vec<u8>[src]

Copies self into a Vector mask is an optional parameter: An exclusive range - i.e - from start to end - 1

pub fn clone_masked(&self, mask: Range<usize>) -> Self[src]

Applies the mask to the current object and creates a new SgData object which describes only masked region observers are not cloned since this is a deep-copy cloning

pub fn copy_masked(&self, mask: Range<usize>) -> Self[src]

Applies the mask to the current object and creates a new SgData object which describes only masked region observers are cloned since this is a shallow-copy clonning, and we want to make sure the data is not used-after-free.

pub fn is_iovec(&self) -> bool[src]

Checks whether this instance is built from Iovec

pub fn is_sglist(&self) -> bool[src]

Checks whether this instance is built from SgList

pub fn append(&mut self, other: &mut Self)[src]

Deprecated since 0.2.2:

use Extend::extend() instead

pub fn zero(capacity: usize) -> Self[src]

Creates an efficient (ZLE) zeroed buffer

pub fn observe(&mut self, observer: &O)[src]

let observer know when the data associated with this sg-data is dropped.

Trait Implementations

impl<O> PartialEq<SgData<O>> for SgData<O> where
    O: Clone
[src]

fn eq(&self, other: &Self) -> bool[src]

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<O> Default for SgData<O> where
    O: Clone
[src]

impl<O> Clone for SgData<O> where
    O: Clone
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<O> Extend<u8> for SgData<O> where
    O: Clone
[src]

impl<'a, O> Extend<&'a [u8]> for SgData<O> where
    O: Clone
[src]

impl<O> Extend<Iovec> for SgData<O> where
    O: Clone
[src]

impl<'a, O> Extend<&'a Iovec> for SgData<O> where
    O: Clone
[src]

impl<O> Extend<SgData<O>> for SgData<O> where
    O: Clone
[src]

impl<O> From<SgList> for SgData<O> where
    O: Clone
[src]

impl<O> From<Vec<u8>> for SgData<O> where
    O: Clone
[src]

impl<O> From<Vec<Vec<u8>>> for SgData<O> where
    O: Clone
[src]

impl<O> From<Iovec> for SgData<O> where
    O: Clone
[src]

impl<O> From<Vec<Iovec>> for SgData<O> where
    O: Clone
[src]

impl<O> From<Zle> for SgData<O> where
    O: Clone
[src]

impl<O> From<SgData<O>> for Vec<u8> where
    O: Clone
[src]

impl<O> Add<SgData<O>> for SgData<O> where
    O: Clone
[src]

type Output = Self

The resulting type after applying the + operator.

impl<O> AddAssign<SgData<O>> for SgData<O> where
    O: Clone
[src]

impl<O> FromIterator<u8> for SgData<O> where
    O: Clone
[src]

impl<O> FromIterator<Vec<u8>> for SgData<O> where
    O: Clone
[src]

impl<O> FromIterator<Iovec> for SgData<O> where
    O: Clone
[src]

impl<O> FromIterator<SgData<O>> for SgData<O> where
    O: Clone
[src]

impl<O: Debug> Debug for SgData<O> where
    O: Clone
[src]

impl<O> Serialize for SgData<O> where
    O: Clone
[src]

impl<'de, O> Deserialize<'de> for SgData<O> where
    O: Clone
[src]

impl<O> Value for SgData<O> where
    O: Clone
[src]

Auto Trait Implementations

impl<O> Send for SgData<O> where
    O: Send

impl<O> Sync for SgData<O> where
    O: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

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

The type returned in the event of a conversion error.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]