pub struct ListPool<T: Clone + Debug> {
pub storage: Vec<T>,
}
Expand description
A “storage pool” backing many ListRef
s of the given type.
Fields§
§storage: Vec<T>
Implementations§
Source§impl<T: Clone + Debug> ListPool<T>
impl<T: Clone + Debug> ListPool<T>
Sourcepub fn from_iter<I: Iterator<Item = T>>(&mut self, iter: I) -> ListRef<T>
pub fn from_iter<I: Iterator<Item = T>>(&mut self, iter: I) -> ListRef<T>
Create a new list in this pool from the items yielded by the given iterator.
Sourcepub fn single(&mut self, value: T) -> ListRef<T>
pub fn single(&mut self, value: T) -> ListRef<T>
Convenience method: create a list from a single item.
Sourcepub fn double(&mut self, a: T, b: T) -> ListRef<T>
pub fn double(&mut self, a: T, b: T) -> ListRef<T>
Convenience methodS: create a list from exactly two items.
Sourcepub fn triple(&mut self, a: T, b: T, c: T) -> ListRef<T>
pub fn triple(&mut self, a: T, b: T, c: T) -> ListRef<T>
Convenience method: create a list from exactly three items.
Sourcepub fn allocate(&mut self, size: usize, initial: T) -> ListRef<T>
pub fn allocate(&mut self, size: usize, initial: T) -> ListRef<T>
Allocate a list of the given size with size
copies of the
value initial
.
Sourcepub fn deep_clone(&mut self, list: ListRef<T>) -> ListRef<T>
pub fn deep_clone(&mut self, list: ListRef<T>) -> ListRef<T>
Perform a deep-clone of a list: copy it to a new list and return the handle of that list.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for ListPool<T>
impl<'de, T> Deserialize<'de> for ListPool<T>
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
Auto Trait Implementations§
impl<T> Freeze for ListPool<T>
impl<T> RefUnwindSafe for ListPool<T>where
T: RefUnwindSafe,
impl<T> Send for ListPool<T>where
T: Send,
impl<T> Sync for ListPool<T>where
T: Sync,
impl<T> Unpin for ListPool<T>where
T: Unpin,
impl<T> UnwindSafe for ListPool<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more