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 try_take_coord_block(
        &mut self,
        _n: usize,
        _spec_version: u32,
        _start_id: u64,
        _symbol: &Arc<str>,
        _workers: usize,
    ) -> Option<CoordRows> { ... }
    fn remainder_is_whitespace(&mut self) -> bool { ... }
    fn blank_line_opens_section(&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> { ... }
    fn next_vector_row(
        &mut self,
        spec_version: u32,
    ) -> Result<([f64; 3], [bool; 3], u64), ParseError> { ... }
}

Required Methods§

Source

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

Source

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

Provided Methods§

Source

fn try_take_coord_block( &mut self, _n: usize, _spec_version: u32, _start_id: u64, _symbol: &Arc<str>, _workers: usize, ) -> Option<CoordRows>

Take n coordinate rows starting at the cursor, or None to keep the one-row loop. The cursor moves only when this returns Some.

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_line_opens_section(&mut self) -> bool

Called while a blank line is peeked. True when that blank begins a section: the next line is a symbol and the line after it is a component label. A blank that does not is line 1 of the next frame.

Source

fn blank_opens_velocity_block(&mut self) -> bool

With a blank line peeked, true when Self::blank_line_opens_section is true. A stream that cannot look ahead keeps the legacy rule and returns true.

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.

Source

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

One vector-section row (xyz, flag, required id), fused with the line scan when the stream can do it. End of input is ParseError::IncompleteFrame; callers that are inside a named section map that to IncompleteSection.

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> + Clone,

Source§

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

Source§

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

Source§

fn blank_line_opens_section(&mut self) -> bool

Source§

fn blank_opens_velocity_block(&mut self) -> bool

Implementors§

Source§

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