TextRange

Trait TextRange 

Source
pub trait TextRange: Clone {
    // Required method
    fn to_range(self, max: usize) -> Range<usize> ;
}
Expand description

Ranges that can be used to index the Text

All of the ranges in std that implement either RangeBounds<usize> or RangeBounds<Point> should work as an argument. If it implements RangeBounds<usize>, then the usize represents the a byte index in the Text.

Required Methods§

Source

fn to_range(self, max: usize) -> Range<usize>

A “forward facing range”

If given a single usize/Point, acts like RangeFrom

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 TextRange for RangeFrom<usize>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeFrom<Point>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeFull

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeInclusive<usize>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeInclusive<Point>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeTo<usize>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeTo<Point>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeToInclusive<usize>

Source§

fn to_range(self, max: usize) -> Range<usize>

Source§

impl TextRange for RangeToInclusive<Point>

Source§

fn to_range(self, max: usize) -> Range<usize>

Implementors§