pub trait CharStream: IntStream {
// Required method
fn text(&self, interval: TextInterval) -> String;
// Provided methods
fn symbol_at(&self, _index: usize) -> Option<i32> { ... }
fn contiguous_ascii(&self) -> Option<&[u8]> { ... }
fn position_summary(
&self,
_start: usize,
_end: usize,
) -> Option<PositionSummary> { ... }
fn source_text(&self) -> Option<Rc<str>> { ... }
fn byte_interval(&self, interval: TextInterval) -> Option<(usize, usize)> { ... }
fn text_source_interval(
&self,
_interval: TextInterval,
) -> Option<(Rc<str>, usize, usize)> { ... }
}Required Methods§
fn text(&self, interval: TextInterval) -> String
Provided Methods§
Sourcefn symbol_at(&self, _index: usize) -> Option<i32>
fn symbol_at(&self, _index: usize) -> Option<i32>
Reads one Unicode scalar at an absolute character index without moving the stream cursor.
Returning None leaves callers on the compatible seek + la
fallback. Implementations that support immutable access return
EOF when index is outside the input.
Sourcefn contiguous_ascii(&self) -> Option<&[u8]>
fn contiguous_ascii(&self) -> Option<&[u8]>
Returns the complete input as ASCII bytes when character and byte indexes are identical.
Sourcefn position_summary(
&self,
_start: usize,
_end: usize,
) -> Option<PositionSummary>
fn position_summary( &self, _start: usize, _end: usize, ) -> Option<PositionSummary>
Summarizes source-position changes for the half-open character interval
[start, end) without moving the stream cursor.
Implementations may clamp end to the input size. Returning None
leaves callers on scalar replay.
Sourcefn source_text(&self) -> Option<Rc<str>>
fn source_text(&self) -> Option<Rc<str>>
Returns the complete backing UTF-8 source when it can be shared with a token store.
Implementations that return None remain supported, but their token
text is copied into the store’s sparse explicit-text pool.
fn byte_interval(&self, interval: TextInterval) -> Option<(usize, usize)>
fn text_source_interval( &self, _interval: TextInterval, ) -> Option<(Rc<str>, usize, usize)>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".