pub struct List { /* private fields */ }Expand description
A list: a finite sequence, in order.
Implementations§
Source§impl List
impl List
Sourcepub fn get(&self, index: usize) -> Option<&Value>
pub fn get(&self, index: usize) -> Option<&Value>
Returns the element at a zero-based position.
Sourcepub fn get_int(&self, index: &Int) -> Option<&Value>
pub fn get_int(&self, index: &Int) -> Option<&Value>
Returns the element at a zero-based Int position: None for a
negative one or one not less than the length (list.get).
Sourcepub fn iter(
&self,
) -> impl DoubleEndedIterator<Item = &Value> + ExactSizeIterator
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = &Value> + ExactSizeIterator
Returns the elements, in order.
Sourcepub fn slice(&self, start: usize, end: usize) -> Option<List>
pub fn slice(&self, start: usize, end: usize) -> Option<List>
Returns the elements from start up to, not including, end, sharing
this list’s buffer, or None unless start ≤ end ≤ length.
Sourcepub fn push_front(self, item: Value) -> List
pub fn push_front(self, item: Value) -> List
Returns self with item added at the front.
Sourcepub fn concat(self, other: List) -> List
pub fn concat(self, other: List) -> List
Returns self ++ other.
The elements are added to a buffer nothing else holds: other’s when
only it is unshared, or when both are and it is the longer, and
otherwise self’s, copied first if it is shared. A list grown one
element at a time from either end therefore costs time in what it adds.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for List
impl !UnwindSafe for List
impl Freeze for List
impl Send for List
impl Sync for List
impl Unpin for List
impl UnsafeUnpin for List
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