pub struct TextRange {
pub start: TextPosition,
pub end: TextPosition,
}Expand description
A byte range in source text.
The range starts at start and ends at end, both expressed as zero-based
line plus UTF-8 byte offset positions. Consumers can convert this into their
presentation protocol’s expected position encoding.
let range = achitek_source::TextRange {
start: achitek_source::TextPosition { line: 0, byte: 0 },
end: achitek_source::TextPosition { line: 0, byte: 4 },
};
assert_eq!(range.start.byte, 0);
assert_eq!(range.end.byte, 4);Fields§
§start: TextPositionStart position of the range.
end: TextPositionEnd position of the range.
Implementations§
Source§impl TextRange
impl TextRange
Sourcepub fn new(start: TextPosition, end: TextPosition) -> Self
pub fn new(start: TextPosition, end: TextPosition) -> Self
Creates a source range from start and end positions.
let range = achitek_source::TextRange::new(
achitek_source::TextPosition::new(0, 0),
achitek_source::TextPosition::new(0, 4),
);
assert_eq!(range.end.byte, 4);Trait Implementations§
impl Copy for TextRange
impl Eq for TextRange
Source§impl Ord for TextRange
impl Ord for TextRange
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for TextRange
impl PartialOrd for TextRange
impl StructuralPartialEq for TextRange
Auto Trait Implementations§
impl Forget for TextRange
impl Freeze for TextRange
impl Move for TextRange
impl RefUnwindSafe for TextRange
impl Send for TextRange
impl Sync for TextRange
impl Unpin for TextRange
impl UnsafeUnpin for TextRange
impl UnwindSafe for TextRange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more