Trait freya::prelude::WritableVecExt
pub trait WritableVecExt<T>: Writable<Target = Vec<T>>where
T: 'static,{
// Provided methods
fn push(&mut self, value: T) { ... }
fn pop(&mut self) -> Option<T> { ... }
fn insert(&mut self, index: usize, value: T) { ... }
fn remove(&mut self, index: usize) -> T { ... }
fn clear(&mut self) { ... }
fn extend(&mut self, iter: impl IntoIterator<Item = T>) { ... }
fn truncate(&mut self, len: usize) { ... }
fn swap_remove(&mut self, index: usize) -> T { ... }
fn retain(&mut self, f: impl FnMut(&T) -> bool) { ... }
fn split_off(&mut self, at: usize) -> Vec<T> { ... }
fn get_mut(&mut self, index: usize) -> Option<Self::Mut<'_, T>> { ... }
fn iter_mut(&mut self) -> WritableValueIterator<'_, Self> ⓘ
where Self: Sized + Clone { ... }
}
Expand description
An extension trait for Writable<Vec<T>>
that provides some convenience methods.
Provided Methods§
fn push(&mut self, value: T)
fn push(&mut self, value: T)
Pushes a new value to the end of the vector.
fn clear(&mut self)
fn clear(&mut self)
Clears the vector, removing all values.
fn extend(&mut self, iter: impl IntoIterator<Item = T>)
fn extend(&mut self, iter: impl IntoIterator<Item = T>)
Extends the vector with the given iterator.
fn swap_remove(&mut self, index: usize) -> T
fn swap_remove(&mut self, index: usize) -> T
Swaps two values in the vector.
fn retain(&mut self, f: impl FnMut(&T) -> bool)
fn retain(&mut self, f: impl FnMut(&T) -> bool)
Retains only the values that match the given predicate.
fn get_mut(&mut self, index: usize) -> Option<Self::Mut<'_, T>>
fn get_mut(&mut self, index: usize) -> Option<Self::Mut<'_, T>>
Try to mutably get an element from the vector.
fn iter_mut(&mut self) -> WritableValueIterator<'_, Self> ⓘ
fn iter_mut(&mut self) -> WritableValueIterator<'_, Self> ⓘ
Gets an iterator over the values of the vector.
Object Safety§
This trait is not object safe.