pub struct Children<T>(/* private fields */);Expand description
A node’s children in order, each under its order key.
Implementations§
Source§impl<T> Children<T>
impl<T> Children<T>
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = &T> + ExactSizeIterator
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &T> + ExactSizeIterator
The children in order.
pub fn iter_mut( &mut self, ) -> impl DoubleEndedIterator<Item = &mut T> + ExactSizeIterator
Sourcepub fn entries(&self) -> impl DoubleEndedIterator<Item = (&OrderKey, &T)>
pub fn entries(&self) -> impl DoubleEndedIterator<Item = (&OrderKey, &T)>
The children in order, with their keys.
pub fn get(&self, key: &OrderKey) -> Option<&T>
pub fn get_mut(&mut self, key: &OrderKey) -> Option<&mut T>
Sourcepub fn nth(&self, at: usize) -> Option<&T>
pub fn nth(&self, at: usize) -> Option<&T>
The child at places from the first, counting each one before it:
for tests, and for callers that hold a place, not a key.
Sourcepub fn nth_mut(&mut self, at: usize) -> Option<&mut T>
pub fn nth_mut(&mut self, at: usize) -> Option<&mut T>
The child at places from the first, to change.
pub fn first_key(&self) -> Option<&OrderKey>
pub fn last_key(&self) -> Option<&OrderKey>
Sourcepub fn key_after(&self, key: &OrderKey) -> Option<&OrderKey>
pub fn key_after(&self, key: &OrderKey) -> Option<&OrderKey>
The key of the child after the one under key, if any.
Sourcepub fn key_before(&self, key: &OrderKey) -> Option<&OrderKey>
pub fn key_before(&self, key: &OrderKey) -> Option<&OrderKey>
The key of the child before the one under key, if any.
Sourcepub fn insert_after(&mut self, after: Option<&OrderKey>, t: T) -> OrderKey
pub fn insert_after(&mut self, after: Option<&OrderKey>, t: T) -> OrderKey
Places t right after the child under after, or first when None,
and returns its key.
Sourcepub fn put(&mut self, key: OrderKey, t: T)
pub fn put(&mut self, key: OrderKey, t: T)
Places t under key, which no child has: where it was taken from.
pub fn remove(&mut self, key: &OrderKey) -> Option<T>
pub fn clear(&mut self)
Trait Implementations§
Source§impl<T> FromIterator<T> for Children<T>
impl<T> FromIterator<T> for Children<T>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, T> IntoIterator for &'a Children<T>
impl<'a, T> IntoIterator for &'a Children<T>
Auto Trait Implementations§
impl<T> Freeze for Children<T>
impl<T> RefUnwindSafe for Children<T>
impl<T> Send for Children<T>
impl<T> Sync for Children<T>
impl<T> Unpin for Children<T>
impl<T> UnsafeUnpin for Children<T>
impl<T> UnwindSafe for Children<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