Skip to main content

CaptureLevel

Struct CaptureLevel 

Source
pub struct CaptureLevel<'capture, Position> { /* private fields */ }
Expand description

One nesting level borrowed from a CaptureBuilder.

A producer can append atoms or groups and cannot state a path, a handle, or a denominator. Every operation consumes the level, and only a successful operation returns it, so a refused partial level cannot be finished.

Implementations§

Source§

impl<Position: Clone> CaptureLevel<'_, Position>

Source

pub fn finish(self) -> CapturedInput

Finish this root level as one captured input.

The issued denominator is read from the builder’s retained position roster rather than accepted from the producer.

Source

pub fn examined<ProducerRefusal>( self, position: Position, ) -> Result<Self, CaptureBuildRefusal<Position, ProducerRefusal>>

Charge one producer observation that does not become a captured token.

This is the work-budget seat for a producer that skips trivia or backtracks before it offers an atom or group.

§Errors

Returns CaptureBuildRefusal::Unbounded at the producer position where the work budget is spent.

Source

pub fn atom<ProducerRefusal>( self, position: Position, read: impl FnOnce(SpanHandle) -> Result<CapturedAtom, ProducerRefusal>, ) -> Result<Self, CaptureBuildRefusal<Position, ProducerRefusal>>

Append one non-group token after the producer reads its value.

The builder issues the path and handle before invoking read, so a producer refusal retains the exact handle whose source position is already in custody.

§Errors

Returns the bound or producer refusal established at this token.

Source

pub fn group<ProducerRefusal>( self, position: Position, delimiter: CapturedDelimiter, fill: impl FnOnce(SpanHandle, CaptureLevel<'_, Position>) -> Result<CaptureLevel<'_, Position>, CaptureBuildRefusal<Position, ProducerRefusal>>, ) -> Result<Self, CaptureBuildRefusal<Position, ProducerRefusal>>

Append one group and let the same builder own its nested level.

§Errors

Returns the first bound or producer refusal established in pre-order.

Trait Implementations§

Source§

impl<Position> Drop for CaptureLevel<'_, Position>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'capture, Position> !UnwindSafe for CaptureLevel<'capture, Position>

§

impl<'capture, Position> Freeze for CaptureLevel<'capture, Position>
where &'capture mut Vec<Position>: Freeze,

§

impl<'capture, Position> RefUnwindSafe for CaptureLevel<'capture, Position>
where &'capture mut Vec<Position>: RefUnwindSafe,

§

impl<'capture, Position> Send for CaptureLevel<'capture, Position>
where &'capture mut Vec<Position>: Send,

§

impl<'capture, Position> Sync for CaptureLevel<'capture, Position>
where &'capture mut Vec<Position>: Sync,

§

impl<'capture, Position> Unpin for CaptureLevel<'capture, Position>
where &'capture mut Vec<Position>: Unpin,

§

impl<'capture, Position> UnsafeUnpin for CaptureLevel<'capture, Position>
where &'capture mut Vec<Position>: UnsafeUnpin,

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> 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, 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.