pub struct PointerArray<'a, const N: usize = 4> { /* private fields */ }
Implementations§
Source§impl<'a, const N: usize> PointerArray<'a, N>
impl<'a, const N: usize> PointerArray<'a, N>
Source§impl<'a, const N: usize> PointerArray<'a, N>
impl<'a, const N: usize> PointerArray<'a, N>
Sourcepub fn insert_mut<'b, T: 'static>(
self,
value: &'b mut T,
) -> Result<PointerArray<'b, N>, Full<'a, N>>where
'a: 'b,
pub fn insert_mut<'b, T: 'static>(
self,
value: &'b mut T,
) -> Result<PointerArray<'b, N>, Full<'a, N>>where
'a: 'b,
Insert a &mut T to array. This method would consume Self.
If the array have a &mut T already it would replace it and the old one is dropped. *. only the &mut T would be dropped and destructor of T does not run.
On Ok(Self) the array with reference successfully inserted would returned. (Self’s lifetime is shrink to the same of input &mut T).
On Err(Full) the array without modification would be returned. See Full::into_inner for detail.
Sourcepub fn insert_ref<'b, T: 'static>(
self,
value: &'b T,
) -> Result<PointerArray<'b, N>, Full<'a, N>>where
'a: 'b,
pub fn insert_ref<'b, T: 'static>(
self,
value: &'b T,
) -> Result<PointerArray<'b, N>, Full<'a, N>>where
'a: 'b,
The &T version of Self::insert_mut. See it for more detail.
Sourcepub fn remove_ref<T: 'static>(&mut self) -> Option<&'a T>
pub fn remove_ref<T: 'static>(&mut self) -> Option<&'a T>
&T version of Self::remove_mut. See it for detail.
Sourcepub fn remove_mut<T: 'static>(&mut self) -> Option<&'a mut T>
pub fn remove_mut<T: 'static>(&mut self) -> Option<&'a mut T>
Remove &mut T from array. Return None when there is no according type in array.
Sourcepub fn get<T: 'static>(&self) -> Option<&'a T>
pub fn get<T: 'static>(&self) -> Option<&'a T>
Get &T without removing it from the array.
&T can be get from either insert with Self::insert_mut or Self::insert_ref.
Sourcepub fn get_mut<T: 'static>(&mut self) -> Option<&'a mut T>
pub fn get_mut<T: 'static>(&mut self) -> Option<&'a mut T>
Get &mut T without removing it from the array.
&mut T can be get from insert with Self::insert_mut.