[−][src]Struct vmm_sys_util::fam::FamStructWrapper
Methods
impl<T: Default + FamStruct> FamStructWrapper<T>[src]
pub fn new(num_elements: usize) -> FamStructWrapper<T>[src]
Create a new FamStructWrapper with num_elements elements.
The elements will be zero-initialized. The type of the elements will be
FamStruct::Entry.
Arguments
num_elements- The number of elements in the FamStructWrapper.
pub fn from_entries(entries: &[T::Entry]) -> FamStructWrapper<T>[src]
Create a new FamStructWrapper from a slice of elements.
Arguments
entries- The slice ofFamStruct::Entryentries.
pub unsafe fn from_raw(content: Vec<T>) -> Self[src]
Create a new FamStructWrapper from the raw content represented as Vec<T>.
Sometimes we already have the raw content of an FAM struct represented as Vec<T>,
and want to use the FamStructWrapper as accessors.
This function is unsafe because the caller needs to ensure that the raw content is correctly layed out.
Arguments
content- The raw content represented asVec[T].
pub fn into_raw(self) -> Vec<T>[src]
Consume the FamStructWrapper and return the raw content as Vec<T>.
pub fn as_fam_struct_ref(&self) -> &T[src]
Get a reference to the actual FamStruct instance.
pub fn as_mut_fam_struct(&mut self) -> &mut T[src]
Get a mut reference to the actual FamStruct instance.
pub fn as_fam_struct_ptr(&self) -> *const T[src]
Get a pointer to the FamStruct instance.
The caller must ensure that the fam_struct outlives the pointer this function returns, or else it will end up pointing to garbage.
Modifying the container referenced by this pointer may cause its buffer to be reallocated, which would also make any pointers to it invalid.
pub fn as_mut_fam_struct_ptr(&mut self) -> *mut T[src]
Get a mutable pointer to the FamStruct instance.
The caller must ensure that the fam_struct outlives the pointer this function returns, or else it will end up pointing to garbage.
Modifying the container referenced by this pointer may cause its buffer to be reallocated, which would also make any pointers to it invalid.
pub fn as_slice(&self) -> &[T::Entry][src]
Get the elements slice.
pub fn as_mut_slice(&mut self) -> &mut [T::Entry][src]
Get the mutable elements slice.
pub fn push(&mut self, entry: T::Entry) -> Result<(), Error>[src]
Append an element.
Arguments
entry- The element that will be appended to the end of the collection.
Errors
When len is already equal to max possible len it returns Error::SizeLimitExceeded.
pub fn retain<P>(&mut self, f: P) where
P: FnMut(&T::Entry) -> bool, [src]
P: FnMut(&T::Entry) -> bool,
Retain only the elements specified by the predicate.
Arguments
f- The function used to evaluate whether an entry will be kept or not. Whenfreturnstruethe entry is kept.
Trait Implementations
impl<T: Default + FamStruct + Clone> From<Vec<T>> for FamStructWrapper<T>[src]
impl<T: Default + FamStruct + Clone> Clone for FamStructWrapper<T>[src]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T: Default + FamStruct> PartialEq<FamStructWrapper<T>> for FamStructWrapper<T>[src]
Auto Trait Implementations
impl<T> Send for FamStructWrapper<T> where
T: Send,
T: Send,
impl<T> Sync for FamStructWrapper<T> where
T: Sync,
T: Sync,
impl<T> Unpin for FamStructWrapper<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for FamStructWrapper<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for FamStructWrapper<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,