pub trait TextRange: Clone {
// Required methods
fn to_range_fwd(self, max: usize) -> Range<usize>;
fn to_range_rev(self, max: usize) -> Range<usize>;
fn to_range_at(self, max: usize) -> Range<usize>;
}Expand description
Ranges that can be used to index the Text
These include:
- A single
usize(interpretation varies) - All ranges that implement
RangeBounds<usize> - A single
Point(interpretation varies) - A 2
Pointtuple - A 2
Option<Point>tuple - And a tuple of a
Pointand anOption<Point>
The behavior of usize and Point depends on where they are
sent, but is pretty straightforward:
- On forward iterators, they act as a
RangeFrom - On reverse iterators, they act as a
RangeTo - On insertion of
Tags, they act as a 1 element range
The purpose of this trait is to minimize the number of functions needed to perform tasks.
Required Methods§
Sourcefn to_range_fwd(self, max: usize) -> Range<usize>
fn to_range_fwd(self, max: usize) -> Range<usize>
Sourcefn to_range_rev(self, max: usize) -> Range<usize>
fn to_range_rev(self, max: usize) -> Range<usize>
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.