pub struct NbtCompoundList<'a, 'tape> { /* private fields */ }Expand description
A wrapper over NbtCompoundListIter that acts more like a Vec.
Implementations§
Source§impl<'a, 'tape> NbtCompoundList<'a, 'tape>
impl<'a, 'tape> NbtCompoundList<'a, 'tape>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of tags directly in this list.
Note that due to an internal optimization, this function runs at O(n)
if the list has at least 2^24 items. Use Self::approx_len if you
want to avoid that.
Sourcepub fn approx_len(&self) -> u32
pub fn approx_len(&self) -> u32
A version of Self::len that saturates at 2^24.
Sourcepub fn get(&self, index: usize) -> Option<NbtCompound<'a, 'tape>>
pub fn get(&self, index: usize) -> Option<NbtCompound<'a, 'tape>>
Get the element at the given index. This is O(n) where n is index, so
if you’ll be calling this more than once you should probably just use
the iterator.
pub fn first(&self) -> Option<NbtCompound<'a, 'tape>>
pub fn last(&self) -> Option<NbtCompound<'a, 'tape>>
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'a, 'tape> Clone for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> Clone for NbtCompoundList<'a, 'tape>
Source§fn clone(&self) -> NbtCompoundList<'a, 'tape>
fn clone(&self) -> NbtCompoundList<'a, 'tape>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a, 'tape> Default for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> Default for NbtCompoundList<'a, 'tape>
Source§fn default() -> NbtCompoundList<'a, 'tape>
fn default() -> NbtCompoundList<'a, 'tape>
Returns the “default value” for a type. Read more
Source§impl<'a: 'tape, 'tape> IntoIterator for NbtCompoundList<'a, 'tape>
impl<'a: 'tape, 'tape> IntoIterator for NbtCompoundList<'a, 'tape>
Source§impl PartialEq for NbtCompoundList<'_, '_>
impl PartialEq for NbtCompoundList<'_, '_>
Auto Trait Implementations§
impl<'a, 'tape> Freeze for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> RefUnwindSafe for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> !Send for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> !Sync for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> Unpin for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> UnsafeUnpin for NbtCompoundList<'a, 'tape>
impl<'a, 'tape> UnwindSafe for NbtCompoundList<'a, 'tape>
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