Skip to main content

VariableArityNode

Struct VariableArityNode 

Source
pub struct VariableArityNode<G: DenseId, O: DenseId> {
    pub global_id: G::Repr,
    pub op: O::Repr,
    pub start: usize,
    pub end: usize,
    pub flags: u8,
}
Expand description

A node whose children live in a shared side pool, addressed by a [start, end) span.

start/end stay usize deliberately, and this is the one place in the store where that is the right answer rather than an unfixed hardcoding. Everywhere else a stored index drops to the id family’s Index word, because what it addresses is one-per-id and so its population is bounded by the id capacity — ClassData::min_row is the pattern: one pool row per class, so a row number cannot outgrow T::Index.

The child pool has no such bound. Its length is the sum of arities over every variable-arity node, which no single population bounds: G::Index bounds the node count, and nothing at all bounds the per-node arity. Narrowing these two words to G::Index would therefore not track a width — it would install a fresh capacity cap at G::Index::MAX children in total, reachable at the 31-bit config with a few large AC terms, reintroducing the capacity cap this representation avoids. Pointer width is the honest width for an offset into a pool whose population is Σ arity.

The size is asserted below, so this choice is priced rather than assumed: two usize words are what put the node at 32 bytes.

Fields§

§global_id: G::Repr§op: O::Repr§start: usize

Inclusive start of this node’s span in the child pool. usize, not G::Index — see the type doc: the pool’s population is Σ arity, which the id capacity does not bound.

§end: usize

Exclusive end of this node’s span in the child pool. usize for the same reason as start.

§flags: u8

Implementations§

Source§

impl<G: DenseId, O: DenseId> VariableArityNode<G, O>

Source

pub fn make(global_id: G, op: O, start: usize, end: usize) -> Self

Source

pub fn global_id(&self) -> G

Source

pub fn op(&self) -> O

Source

pub fn has_history(&self) -> bool

Source

pub fn set_history(&mut self)

Source

pub fn span(&self) -> (usize, usize)

Source

pub fn with_end(self, new_end: usize) -> Self

Trait Implementations§

Source§

impl<G: Clone + DenseId, O: Clone + DenseId> Clone for VariableArityNode<G, O>
where G::Repr: Clone, O::Repr: Clone,

Source§

fn clone(&self) -> Self

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<G: Copy + DenseId, O: Copy + DenseId> Copy for VariableArityNode<G, O>
where G::Repr: Copy, O::Repr: Copy,

Source§

impl<G: Debug + DenseId, O: Debug + DenseId> Debug for VariableArityNode<G, O>
where G::Repr: Debug, O::Repr: Debug,

Source§

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

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

impl<G: DenseId, O: DenseId> Default for VariableArityNode<G, O>

Source§

fn default() -> Self

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

impl<G: DenseId, O: DenseId> Tagged for VariableArityNode<G, O>

Source§

type Repr = VariableArityNode<G, O>

Source§

fn into_repr(self) -> Self

Encode a clean value with tag = false. Result is well-formed.
Source§

fn from_repr(stored: &Self) -> Self

Decode a Repr to its clean value, stripping the tag.
Source§

fn tag(stored: &Self) -> bool

Read the tag bit.
Source§

fn set_tag(stored: &mut Self)

Set the tag bit. Value, well-formedness preserved.
Source§

fn clear_tag(stored: &mut Self)

Clear the tag bit. Value, well-formedness preserved.

Auto Trait Implementations§

§

impl<G, O> Freeze for VariableArityNode<G, O>
where <G as Tagged>::Repr: Freeze, <O as Tagged>::Repr: Freeze,

§

impl<G, O> RefUnwindSafe for VariableArityNode<G, O>
where <G as Tagged>::Repr: RefUnwindSafe, <O as Tagged>::Repr: RefUnwindSafe,

§

impl<G, O> Send for VariableArityNode<G, O>
where <G as Tagged>::Repr: Send, <O as Tagged>::Repr: Send,

§

impl<G, O> Sync for VariableArityNode<G, O>
where <G as Tagged>::Repr: Sync, <O as Tagged>::Repr: Sync,

§

impl<G, O> Unpin for VariableArityNode<G, O>
where <G as Tagged>::Repr: Unpin, <O as Tagged>::Repr: Unpin,

§

impl<G, O> UnsafeUnpin for VariableArityNode<G, O>
where <G as Tagged>::Repr: UnsafeUnpin, <O as Tagged>::Repr: UnsafeUnpin,

§

impl<G, O> UnwindSafe for VariableArityNode<G, O>
where <G as Tagged>::Repr: UnwindSafe, <O as Tagged>::Repr: 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.