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_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> { ... }
}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§
Provided Methods§
Sourcefn remainder_is_whitespace(&mut self) -> bool
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.
Sourcefn blank_line_opens_section(&mut self) -> bool
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.
Sourcefn blank_opens_velocity_block(&mut self) -> bool
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.
Sourcefn next_coord_row(
&mut self,
spec_version: u32,
default_id: u64,
) -> Result<([f64; 3], [bool; 3], u64), ParseError>
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.
Sourcefn next_vector_row(
&mut self,
spec_version: u32,
) -> Result<([f64; 3], [bool; 3], u64), ParseError>
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".