pub struct TreeDraft {
pub shape: TreeShape,
pub spine: Vec<u32>,
pub hedges: Vec<HedgeNode>,
}Expand description
2026-09-25: A proposed draft tree for one verify step.
Fields§
§shape: TreeShape§spine: Vec<u32>2026-09-25: spine[d-1] is the top-1 draft at depth d.
hedges: Vec<HedgeNode>2026-09-25: Hedge leaves; rows lays them out in this order, and
callers keep it sorted by (depth, rank).
Implementations§
Source§impl TreeDraft
impl TreeDraft
Sourcepub fn rows(&self, root_token: u32) -> Vec<TreeRow>
pub fn rows(&self, root_token: u32) -> Vec<TreeRow>
2026-09-25: Verify rows [root, spine..., hedges...]. root_token is
the last committed token. A depth-d node’s parent is row d-1, the
spine node (or the root) one depth up.
Sourcepub fn accept_path(&self, rows: &[TreeRow], v: &[u32]) -> (Vec<usize>, u32)
pub fn accept_path(&self, rows: &[TreeRow], v: &[u32]) -> (Vec<usize>, u32)
2026-09-25: The accepted rows, root to leaf, given v[row], the
target’s next token after each row. Returns them with the bonus token
v at the last accepted row (row 0 when none is accepted).
Each step accepts the child whose token equals v[parent], so the
accepted tokens are the ones greedy decoding of the target emits. The
spine child is checked first, then the hedges in order, and the first
match wins. Accepting a hedge ends the path, since a hedge is a leaf.
Panics when rows or v is shorter than the row layout of this draft.