Skip to main content

LineStream

Trait LineStream 

Source
pub trait LineStream<'a> {
    // Required methods
    fn next_line(&mut self) -> Option<&'a str>;
    fn peek_line(&mut self) -> Option<&'a str>;

    // Provided methods
    fn remainder_is_whitespace(&mut self) -> bool { ... }
    fn blank_opens_velocity_block(&mut self) -> bool { ... }
    fn next_coord_row(
        &mut self,
        spec_version: u32,
        default_id: u64,
    ) -> Result<([f64; 3], [bool; 3], u64), ParseError> { ... }
}
Expand description

Line source with peek for section detection (blank-line separators).

Implemented by the memchr cursor on the hot iterator path and by Peekable<I> for tests / ad-hoc callers.

Required Methods§

Source

fn next_line(&mut self) -> Option<&'a str>

Source

fn peek_line(&mut self) -> Option<&'a str>

Provided Methods§

Source

fn remainder_is_whitespace(&mut self) -> bool

True when every remaining line, including the current peek, is empty or whitespace. Default is false so a one-line peek cannot hide a following section.

Source

fn blank_opens_velocity_block(&mut self) -> bool

With a blank line peeked, true unless the stream can see that the line two past the blank is not a Velocities of Component label. Default is true, which keeps the legacy blank-separator rule.

Source

fn next_coord_row( &mut self, spec_version: u32, default_id: u64, ) -> Result<([f64; 3], [bool; 3], u64), ParseError>

One coordinate row, fused with the line scan when the stream can do it.

The default pulls a &str line. crate::iterators::MemchrLines parses the row directly from the byte cursor so tokenize and numeric parse are one pass.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, I> LineStream<'a> for Peekable<I>
where I: Iterator<Item = &'a str>,

Source§

fn next_line(&mut self) -> Option<&'a str>

Source§

fn peek_line(&mut self) -> Option<&'a str>

Implementors§

Source§

impl<'a> LineStream<'a> for MemchrLines<'a>