[−][src]Struct rexsgdata::SgData
High Level wrapper for multiple data representation methods. It has 2 fields:
-
data - a vector of heterogeneous data representations.
-
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 methodcopy_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]
O: Clone,
pub fn with_capacity(capcity: usize) -> Self
[src]
Create an SgData
with specified capacity
pub fn iter(
&self
) -> impl Iterator<Item = &[u8]>
[src]
&self
) -> impl Iterator<Item = &[u8]>
Iterates over all the underlying byte slices of this SgData
.
pub fn iter_mut(
&mut self
) -> impl Iterator<Item = &mut [u8]>
[src]
&mut self
) -> impl Iterator<Item = &mut [u8]>
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]
&'a self,
mask: &'a Range<usize>
) -> impl Iterator<Item = &[u8]> + 'a
Given a mask
iterates over slices
that a 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]
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]
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> From<SgList> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> From<Vec<u8>> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> From<Vec<Vec<u8>>> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> From<Iovec> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> From<Vec<Iovec>> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> From<Zle> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> From<SgData<O>> for Vec<u8> where
O: Clone,
[src]
O: Clone,
impl<O> Clone for SgData<O> where
O: Clone,
[src]
O: Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<O> PartialEq<SgData<O>> for SgData<O> where
O: Clone,
[src]
O: Clone,
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]
O: Clone,
impl<O> Extend<u8> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = u8>,
[src]
T: IntoIterator<Item = u8>,
impl<'a, O> Extend<&'a [u8]> for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> Extend<Iovec> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = Iovec>,
[src]
T: IntoIterator<Item = Iovec>,
impl<'a, O> Extend<&'a Iovec> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = &'a Iovec>,
[src]
T: IntoIterator<Item = &'a Iovec>,
impl<O> Extend<SgData<O>> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = Self>,
[src]
T: IntoIterator<Item = Self>,
impl<O> Add<SgData<O>> for SgData<O> where
O: Clone,
[src]
O: Clone,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
impl<O> AddAssign<SgData<O>> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn add_assign(&mut self, rhs: Self)
[src]
impl<O> FromIterator<u8> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = u8>,
[src]
T: IntoIterator<Item = u8>,
impl<O> FromIterator<Vec<u8>> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Vec<u8>>,
[src]
T: IntoIterator<Item = Vec<u8>>,
impl<O> FromIterator<Iovec> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Iovec>,
[src]
T: IntoIterator<Item = Iovec>,
impl<O> FromIterator<SgData<O>> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Self>,
[src]
T: IntoIterator<Item = Self>,
impl<O: Debug> Debug for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<O> Serialize for SgData<O> where
O: Clone,
[src]
O: Clone,
impl<'de, O> Deserialize<'de> for SgData<O> where
O: Clone,
[src]
O: Clone,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<O> Value for SgData<O> where
O: Clone,
[src]
O: Clone,
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,