pub struct Seq<T>(/* private fields */);
Expand description
A lazily evaluated sequence of functions.
Implementations§
Source§impl<T> Seq<T>
impl<T> Seq<T>
pub fn capacity(&self) -> usize
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the sequence, also referred to as its ‘length’.
Sourcepub fn with_capacity(capacity: usize) -> Seq<T>
pub fn with_capacity(capacity: usize) -> Seq<T>
Constructs a new, empty Seq<T>
with the specified capacity.
Sourcepub fn push<F: FnOnce() -> T + 'static>(&mut self, value: F)
pub fn push<F: FnOnce() -> T + 'static>(&mut self, value: F)
Appends the provided function to the back of the collection.
Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Forces evaluation of the last function in the sequence, returning the result.
Sourcepub fn to_vec(self) -> Vec<T>
pub fn to_vec(self) -> Vec<T>
Converts a Seq<T>
to a Vec<T>
by forcing evaluation of all functions.
Sourcepub fn to_lazy_vec(self) -> Vec<Lazy<T>>
pub fn to_lazy_vec(self) -> Vec<Lazy<T>>
Converts a Seq<T>
to a Vec<Lazy<T>>
without evaluating any additional
functions.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Seq<T>
impl<T> !RefUnwindSafe for Seq<T>
impl<T> !Send for Seq<T>
impl<T> !Sync for Seq<T>
impl<T> Unpin for Seq<T>where
T: Unpin,
impl<T> !UnwindSafe for Seq<T>
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