Skip to main content

NodeList

Struct NodeList 

Source
pub struct NodeList<'gc> { /* private fields */ }
Expand description

An ordered list of nodes used as a property in the AST.

Implemented as a linked list internally to avoid extra overhead that would exist if it were to allocate a Vec or some other structure that required allocating on the native heap.

Because this is just a Copy head pointer into context-allocated NodeListElements (juno model), it implements Copy much like any other pointer/reference, allowing the user to handle it much like &Node in many cases. Empty == null head.

Implementations§

Source§

impl<'gc> NodeList<'gc>

Source

pub fn empty() -> Self

Create a new empty list. Guaranteed to be fast, performs no allocations.

Source

pub fn from_iter<'a, I: IntoIterator<Item = &'a Node<'a>>>( lock: &'a GCLock<'_, '_>, nodes: I, ) -> NodeList<'a>

Connect the provided pre-existing nodes into a NodeList via iteration. NodeList doesn’t implement FromIterator directly due to the GCLock requirement.

Source

pub fn is_empty(&self) -> bool

Whether this NodeList has no elements. Cost: O(1)

Source

pub fn iter(self) -> NodeListIter<'gc>

Iterate the list front to back. Cost: O(1) to start, O(1) per step.

Trait Implementations§

Source§

impl<'gc> Clone for NodeList<'gc>

Source§

fn clone(&self) -> NodeList<'gc>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'gc> Copy for NodeList<'gc>

Source§

impl<'gc> Debug for NodeList<'gc>

Source§

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

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

impl<'gc> IntoIterator for NodeList<'gc>

Source§

type Item = &'gc Node<'gc>

The type of the elements being iterated over.
Source§

type IntoIter = NodeListIter<'gc>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'gc> !RefUnwindSafe for NodeList<'gc>

§

impl<'gc> !Send for NodeList<'gc>

§

impl<'gc> !Sync for NodeList<'gc>

§

impl<'gc> !UnwindSafe for NodeList<'gc>

§

impl<'gc> Freeze for NodeList<'gc>

§

impl<'gc> Unpin for NodeList<'gc>

§

impl<'gc> UnsafeUnpin for NodeList<'gc>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.