TextIndex

Trait TextIndex 

Source
pub trait TextIndex:
    Clone
    + Copy
    + Debug {
    // Required method
    fn to_byte_index(self) -> usize;
}
Expand description

A Point or a usize, representing a byte index

In Duat, Points are usually just “thin wrappers” around a byte index, useful for getting other information about a place in the Text, but that extra information is normally ignored when doing internal calculations.

For that reason, Duat allows users to use either Points or byte indices in order to index the Text, for convenience’s sake.

Required Methods§

Source

fn to_byte_index(self) -> usize

Converts this type into a byte index.

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 TextIndex for usize

Implementors§