Struct pwasm_utils::RefList [−][src]
List that tracks references and indices.
Implementations
impl<T> RefList<T>
[src]
pub fn new() -> Self
[src]
New empty list.
pub fn push(&mut self, t: T) -> EntryRef<T>
[src]
Push new element in the list.
Returns refernce tracking entry.
pub fn begin_delete(&mut self) -> DeleteTransaction<'_, T>
[src]
Start deleting.
Start deleting some entries in the list. Returns transaction that can be populated with number of removed entries. When transaction is finailized, all entries are deleted and internal indices of other entries are updated.
pub fn begin_insert(&mut self, at: usize) -> InsertTransaction<'_, T>
[src]
Start inserting.
Start inserting some entries in the list at he designated position. Returns transaction that can be populated with some entries. When transaction is finailized, all entries are inserted and internal indices of other entries might be updated.
pub fn begin_insert_after<F>(&mut self, f: F) -> InsertTransaction<'_, T> where
F: FnMut(&T) -> bool,
[src]
F: FnMut(&T) -> bool,
Start inserting after the condition first matches (or at the end).
Start inserting some entries in the list at he designated position. Returns transaction that can be populated with some entries. When transaction is finailized, all entries are inserted and internal indices of other entries might be updated.
pub fn begin_insert_not_until<F>(&mut self, f: F) -> InsertTransaction<'_, T> where
F: FnMut(&T) -> bool,
[src]
F: FnMut(&T) -> bool,
Start inserting after the condition first no longer true (or at the end).
Start inserting some entries in the list at he designated position. Returns transaction that can be populated with some entries. When transaction is finailized, all entries are inserted and internal indices of other entries might be updated.
pub fn get(&self, idx: usize) -> Option<EntryRef<T>>
[src]
Get entry with index (checked).
Can return None when index out of bounts.
pub fn delete(&mut self, indices: &[usize])
[src]
Delete several items.
pub fn delete_one(&mut self, index: usize)
[src]
Delete one item.
pub fn from_slice(list: &[T]) -> Self where
T: Clone,
[src]
T: Clone,
Initialize from slice.
Slice members are cloned.
pub fn len(&self) -> usize
[src]
Length of the list.
pub fn clone_ref(&self, idx: usize) -> EntryRef<T>
[src]
Clone entry (reference counting object to item) by index.
Will panic if index out of bounds.
pub fn get_ref(&self, idx: usize) -> &EntryRef<T>
[src]
Get reference to entry by index.
Will panic if index out of bounds.
pub fn iter(&self) -> Iter<'_, EntryRef<T>>
[src]
Iterate through entries.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for RefList<T>
impl<T> !Send for RefList<T>
impl<T> !Sync for RefList<T>
impl<T> Unpin for RefList<T>
impl<T> !UnwindSafe for RefList<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,