pub struct SgData { /* private fields */ }Expand description
High Level scatter gather list wrapper for multiple data representation methods.
§Safety: When creating SgData from Iovec / SgList, it is assumed that these
§strustures live longer than the created SgData lifetime.
§This is the user responsibility taking care of
§allocating/deallocating Iovec / SgList memory.
Implementations§
Source§impl SgData
impl SgData
Sourcepub unsafe fn drain_into(self, iovec: *mut iovec, count: usize) -> Self
pub unsafe fn drain_into(self, iovec: *mut iovec, count: usize) -> Self
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.
Sourcepub fn masked(&self, mask: Range<usize>) -> Self
pub fn masked(&self, mask: Range<usize>) -> Self
Applies the mask to the current object and creates a new SgData object which describes
only masked region
pub fn clone_masked(&self, mask: Range<usize>) -> Self
pub unsafe fn from_sglist(sglist: SgList) -> Self
Sourcepub fn iter(&self) -> impl Iterator<Item = &[u8]>
pub fn iter(&self) -> impl Iterator<Item = &[u8]>
Iterates over all the underlying byte slices of this SgData.
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns number of elements in the underlying object, NOT the total number of bytes.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create an SgData with specified capacity
Trait Implementations§
Source§impl AddAssign for SgData
impl AddAssign for SgData
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<'de> Deserialize<'de> for SgData
impl<'de> Deserialize<'de> for SgData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Extend<SgData> for SgData
impl Extend<SgData> for SgData
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Self>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Self>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<u8> for SgData
impl Extend<u8> for SgData
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = u8>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = u8>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<I: Into<Self>> FromIterator<I> for SgData
impl<I: Into<Self>> FromIterator<I> for SgData
Source§fn from_iter<U>(iter: U) -> Selfwhere
U: IntoIterator<Item = I>,
fn from_iter<U>(iter: U) -> Selfwhere
U: IntoIterator<Item = I>,
Creates a value from an iterator. Read more
Source§impl FromIterator<u8> for SgData
impl FromIterator<u8> for SgData
Auto Trait Implementations§
impl !Freeze for SgData
impl RefUnwindSafe for SgData
impl Send for SgData
impl Sync for SgData
impl Unpin for SgData
impl UnwindSafe for SgData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more