NodeSet

Struct NodeSet 

Source
pub struct NodeSet<N: Node> {
    nodes: Vec<N>,
    is_sorted: bool,
}

Fields§

§nodes: Vec<N>§is_sorted: bool

Implementations§

Source§

impl<N: Node> NodeSet<N>

Source

pub(crate) fn len(&self) -> usize

Source

fn is_empty(&self) -> bool

Source

pub(crate) fn push(&mut self, node: N)

Source

pub(crate) fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = N>,

Source

pub(crate) fn is_sorted(&self) -> bool

Whether this set is known to be sorted in tree order.

This method is pessimistic and will never look at the elements in the set. As such, it may return false even if the set happens to be sorted.

Source

pub(crate) fn assume_sorted(&mut self)

Assume that this set is sorted, without actually sorting it.

Source

pub(crate) fn sort(&mut self)

Source

pub(crate) fn iter(&self) -> impl Iterator<Item = &N>

Source

pub(crate) fn first(&self) -> Option<N>

Return the first node in tree order that appears within this set.

This method will not sort the set itself.

Source

pub(crate) fn deduplicate(&mut self)

Source

pub(crate) fn retain<F>(&mut self, f: F)
where F: FnMut(&N) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all elements e for which f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Source

pub(crate) fn reverse(&mut self)

Trait Implementations§

Source§

impl<N: Debug + Node> Debug for NodeSet<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<N: Node> Default for NodeSet<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<N: Node> FromIterator<N> for NodeSet<N>

Source§

fn from_iter<T: IntoIterator<Item = N>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<N: Node> IntoIterator for NodeSet<N>

Source§

type IntoIter = <Vec<N> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

type Item = <Vec<N> as IntoIterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<N> Freeze for NodeSet<N>

§

impl<N> RefUnwindSafe for NodeSet<N>
where N: RefUnwindSafe,

§

impl<N> Send for NodeSet<N>
where N: Send,

§

impl<N> Sync for NodeSet<N>
where N: Sync,

§

impl<N> Unpin for NodeSet<N>
where N: Unpin,

§

impl<N> UnwindSafe for NodeSet<N>
where N: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T