PosnInCharStream

Trait PosnInCharStream 

Source
pub trait PosnInCharStream: UserPosn {
    // Required method
    fn byte_ofs(&self) -> usize;

    // Provided method
    fn move_by_char(self, ch: char) -> Self { ... }
}
Expand description

Trait for location within a character stream

This tracks a byte offset within the stream so that strings can be retrieved from the stream. Byte offsets must always be on UTF8 boundaries.

Required Methods§

Source

fn byte_ofs(&self) -> usize

Return the byte offset into the stream of the position.

This must always be a UTF8 character boundary; it will be so

Provided Methods§

Source

fn move_by_char(self, ch: char) -> Self

Move on by a character

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PosnInCharStream for usize

Source§

fn byte_ofs(&self) -> usize

Implementors§