Skip to main content

HeldStream

Struct HeldStream 

Source
pub struct HeldStream { /* private fields */ }
Expand description

A stream scanner and the bytes from its retained window on, with where they stand in the input: what a reader needs beside the scanner to read each committed match’s text and registers and to place it on its line.

The bytes a push settles are dropped at the next push, so the matches a push commits are read against HeldStream::held until then.

Implementations§

Source§

impl HeldStream

Source

pub fn new( scanner: StreamScanner, origin: usize, lines_before: Option<usize>, ) -> Self

scanner over an input whose first byte stands at origin, after lines_before of its lines; the lines are counted on as the stream moves where they were counted to its start, and left uncounted where they were not.

Source

pub fn commits_early(&self) -> bool

Whether a match can commit before the input ends.

Source

pub fn held(&self) -> &[u8] ⓘ

The bytes held: the input from the scanner’s retained window on.

Source

pub fn base(&self) -> usize

Where the held bytes begin in the input.

Source

pub fn lines_before(&self) -> Option<usize>

How many of the input’s lines come before the held bytes, where the stream counts them.

Source

pub fn settled(&self) -> usize

How much of the held bytes is final: no match can still begin before this offset into them, and every match that ends before it has been committed.

Source

pub fn push(&mut self, bytes: &[u8]) -> Vec<(usize, Span)>

Push the input’s next bytes: the matches they commit, each with the member that made it, as spans over the held bytes.

Source

pub fn finish(self) -> Ended

End the input: the matches the scanner held until then, over the bytes still held.

Auto Trait Implementations§

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.