Skip to main content

Director

Struct Director 

Source
pub struct Director<W: DirectorBits>(/* private fields */);
Expand description

A k×n bit matrix stored inline (MSB=0) or as a spill pool reference (MSB=1).

When W = (), the handle is a ZST. This is a layout fact about the handle, not a whole-engine code-generation or runtime-overhead claim.

Implementations§

Source§

impl<W: DirectorBits> Director<W>

Source

pub fn zero() -> Self

All-zero matrix (ground edge, no variable ports).

Source

pub fn new_inline(bits: u64) -> Self

Inline matrix from raw bits. Panics if bits overflow inline capacity.

Source

pub fn new_spilled(pool_index: usize) -> Self

Spilled matrix referencing a pool entry.

§Capacity

The index shares the director word with the spill tag, so only BITS - 1 bits are available to name a pool entry — 32768 entries for W = u16, a size a real pool reaches easily. The bound is a hard assert! because the old debug_assert! was wrong twice over: it vanished in release, and it compared against the tag bit alone, so 0x8000 was rejected while 0x10000 passed and then truncated to 0 in W::from_u64, aliasing pool entry 0.

Source

pub fn is_inline(&self) -> bool

True if the matrix data is stored inline (not spilled).

Source

pub fn inline_bits(&self) -> u64

Raw inline bits. Panics if spilled.

A hard assert!: as a debug_assert! this returned the pool index as if it were matrix data in release builds — a silently wrong matrix, not a crash. The hot path (resolve) reads the word directly inside its is_inline() branch, so nothing pays for the check twice.

Source

pub fn pool_index(&self) -> usize

Pool start index. Panics if inline.

A hard assert! for the mirror-image reason: in release this handed back matrix bits as a pool index, reading an unrelated entry.

Source

pub fn raw(&self) -> W

Raw word value (for hashing, sort keys).

Source

pub fn row_extract<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, i: u8, n: u8, pool: &DirectorPool<I, TRACK, PROOFS>, ) -> u64

Extract row i from a k×n matrix. Returns an n-bit value with at most one bit set (the parent port that child port i maps to). Zero means child port i is unbound (consumed by a binder).

Source

pub fn col_present<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, j: u8, k: u8, n: u8, pool: &DirectorPool<I, TRACK, PROOFS>, ) -> bool

Does any child port map to parent port j?

Source

pub fn embed_bitset<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, k: u8, n: u8, pool: &DirectorPool<I, TRACK, PROOFS>, ) -> u64

OR of all rows: which parent ports are referenced by any child port?

Source

pub fn compose<I: IndexLike, const TRACK: bool, const PROOFS: bool>( outer: &Self, inner: &Self, k_inner: u8, k_mid: u8, n_outer: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

Chain two edges: outer (k_mid × n_outer) ∘ inner (k_inner × k_mid). Result is k_inner × n_outer.

Source

pub fn widen_columns<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, k: u8, old_n: u8, new_n: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

Parent arity grew from old_n to new_n. Re-lay rows to wider width.

Source

pub fn add_zero_rows<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, old_k: u8, new_k: u8, n: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

Child arity grew from old_k to new_k. New rows are zero.

Source

pub fn permute_rows<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, perm: &[u8], k: u8, n: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

Reorder rows according to a permutation (port reconciliation on merge).

Source

pub fn shift<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, k: u8, n: u8, d: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

Introduce d bound variable ports. Input k×n → result (k+d)×(n+d).

Source

pub fn delete_column<I: IndexLike, const TRACK: bool, const PROOFS: bool>( &self, j: u8, k: u8, n: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

Eliminate parent port j (substitution). Input k×n → result k×(n-1).

Source

pub fn identity<I: IndexLike, const TRACK: bool, const PROOFS: bool>( k: u8, n: u8, pool: &mut DirectorPool<I, TRACK, PROOFS>, ) -> Self

k×n identity matrix. Spills if k*n exceeds inline capacity.

Trait Implementations§

Source§

impl<W: Clone + DirectorBits> Clone for Director<W>

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<W: Copy + DirectorBits> Copy for Director<W>

Source§

impl<W: DirectorBits> Debug for Director<W>

Source§

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

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

impl<W: Eq + DirectorBits> Eq for Director<W>

Source§

impl<W: Hash + DirectorBits> Hash for Director<W>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<W: Ord + DirectorBits> Ord for Director<W>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl<W: PartialEq + DirectorBits> PartialEq for Director<W>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<W: PartialOrd + DirectorBits> PartialOrd for Director<W>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<W: PartialEq + DirectorBits> StructuralPartialEq for Director<W>

Auto Trait Implementations§

§

impl<W> Freeze for Director<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for Director<W>
where W: RefUnwindSafe,

§

impl<W> Send for Director<W>
where W: Send,

§

impl<W> Sync for Director<W>
where W: Sync,

§

impl<W> Unpin for Director<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for Director<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for Director<W>
where W: 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.