pub struct CaptureWalk { /* private fields */ }Expand description
The running state of one capture walk: what the walk has spent, and how much of the whole-tree magnitude it has taken.
The two are charged separately, because a producer that reads material it discards — a frontend skipping trivia, a reader backtracking over an alternative — spends work the result never shows, and the budget is the only magnitude that can see it.
Implementations§
Source§impl CaptureWalk
impl CaptureWalk
Sourcepub const fn declared() -> Self
pub const fn declared() -> Self
A fresh walk, holding the whole declared budget and nothing taken.
Sourcepub fn examined(&mut self) -> Result<(), CaptureBound>
pub fn examined(&mut self) -> Result<(), CaptureBound>
Spend one unit of the declared budget on looking at one token.
§Errors
Returns CaptureBound::Work where the budget is spent.
Sourcepub fn took(&mut self) -> Result<(), CaptureBound>
pub fn took(&mut self) -> Result<(), CaptureBound>
Count one token against the whole-tree magnitude.
§Errors
Returns CaptureBound::Tree where the tree outgrows its declared magnitude.
Trait Implementations§
Source§impl Clone for CaptureWalk
impl Clone for CaptureWalk
Source§fn clone(&self) -> CaptureWalk
fn clone(&self) -> CaptureWalk
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CaptureWalk
Source§impl Debug for CaptureWalk
impl Debug for CaptureWalk
impl Eq for CaptureWalk
Source§impl Hash for CaptureWalk
impl Hash for CaptureWalk
Source§impl PartialEq for CaptureWalk
impl PartialEq for CaptureWalk
impl StructuralPartialEq for CaptureWalk
Auto Trait Implementations§
impl Freeze for CaptureWalk
impl RefUnwindSafe for CaptureWalk
impl Send for CaptureWalk
impl Sync for CaptureWalk
impl Unpin for CaptureWalk
impl UnsafeUnpin for CaptureWalk
impl UnwindSafe for CaptureWalk
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
Mutably borrows from an owned value. Read more