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>
impl<W: DirectorBits> Director<W>
Sourcepub fn new_inline(bits: u64) -> Self
pub fn new_inline(bits: u64) -> Self
Inline matrix from raw bits. Panics if bits overflow inline capacity.
Sourcepub fn new_spilled(pool_index: usize) -> Self
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.
Sourcepub fn inline_bits(&self) -> u64
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.
Sourcepub fn pool_index(&self) -> usize
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.
Sourcepub fn row_extract<I: IndexLike, const TRACK: bool, const PROOFS: bool>(
&self,
i: u8,
n: u8,
pool: &DirectorPool<I, TRACK, PROOFS>,
) -> u64
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).
Sourcepub fn col_present<I: IndexLike, const TRACK: bool, const PROOFS: bool>(
&self,
j: u8,
k: u8,
n: u8,
pool: &DirectorPool<I, TRACK, PROOFS>,
) -> bool
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?
Sourcepub fn embed_bitset<I: IndexLike, const TRACK: bool, const PROOFS: bool>(
&self,
k: u8,
n: u8,
pool: &DirectorPool<I, TRACK, PROOFS>,
) -> u64
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?
Sourcepub 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
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.
Sourcepub 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
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.
Sourcepub 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
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.
Sourcepub 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
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).
Sourcepub fn shift<I: IndexLike, const TRACK: bool, const PROOFS: bool>(
&self,
k: u8,
n: u8,
d: u8,
pool: &mut DirectorPool<I, TRACK, PROOFS>,
) -> Self
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).
Sourcepub 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
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).
Trait Implementations§
impl<W: Copy + DirectorBits> Copy for Director<W>
Source§impl<W: DirectorBits> Debug for Director<W>
impl<W: DirectorBits> Debug for Director<W>
impl<W: Eq + DirectorBits> Eq for Director<W>
Source§impl<W: Ord + DirectorBits> Ord for Director<W>
impl<W: Ord + DirectorBits> Ord for Director<W>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<W: PartialOrd + DirectorBits> PartialOrd for Director<W>
impl<W: PartialOrd + DirectorBits> PartialOrd for Director<W>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.