pub struct AccessedSet(/* private fields */);Expand description
Tracks accessed fields and extensions with snapshot/rollback support for union parsing.
The internal state is a stack where the last item is always the current working state. Items before it are snapshots (save points) for rollback.
Invariant: stack is never empty.
§Stack visualization
Initial: [current]
push_snapshot: [snapshot, current] (snapshot = copy of current)
modify: [snapshot, current'] (current' has changes)
restore: [snapshot, snapshot] (current reset to snapshot)
pop_restore: [snapshot] (current removed, snapshot is new current)
pop_no_restore: [current'] (snapshot removed, keep modified current)Implementations§
Source§impl AccessedSet
impl AccessedSet
Sourcepub fn add_ext(&self, ext: Identifier)
pub fn add_ext(&self, ext: Identifier)
Add an extension to the accessed set.
Sourcepub fn has_ext(&self, ext: &Identifier) -> bool
pub fn has_ext(&self, ext: &Identifier) -> bool
Check if an extension has been accessed.
Sourcepub fn push_snapshot(&self)
pub fn push_snapshot(&self)
Push a snapshot (call at start of union parsing). Inserts a copy of current BEFORE current, so current can be modified.
Sourcepub fn restore_to_current_snapshot(&self)
pub fn restore_to_current_snapshot(&self)
Restore current to the snapshot (call when variant fails). Resets current (last) to match the snapshot (second-to-last).
Sourcepub fn capture_current_state(&self) -> AccessedSnapshot
pub fn capture_current_state(&self) -> AccessedSnapshot
Capture the current state (for non-priority variants).
Sourcepub fn restore_to_state(&self, state: AccessedSnapshot)
pub fn restore_to_state(&self, state: AccessedSnapshot)
Restore to a previously captured state.
Sourcepub fn pop_and_restore(&self)
pub fn pop_and_restore(&self)
Pop and restore (call when union fails/ambiguous). Removes current, snapshot becomes new current.
Sourcepub fn pop_without_restore(&self)
pub fn pop_without_restore(&self)
Pop without restore (call when union succeeds). Removes the snapshot, keeps current.
Trait Implementations§
Source§impl Clone for AccessedSet
impl Clone for AccessedSet
Source§fn clone(&self) -> AccessedSet
fn clone(&self) -> AccessedSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more