pub trait PositionExt {
const MAX: Self;
const MIN: Self;
// Required methods
fn offset(&mut self, lines: i32, characters: i32);
fn set_line(&mut self, line: u32);
fn set_character(&mut self, character: u32);
fn is_in_bounds(&self, start: Self, end: Self) -> bool;
fn is_after(&self, position: Self) -> bool;
fn is_before(&self, position: Self) -> bool;
}Expand description
Extands the Position type by adding helper functions.
Required Associated Constants§
Required Methods§
Sourcefn offset(&mut self, lines: i32, characters: i32)
fn offset(&mut self, lines: i32, characters: i32)
Offsets the current position by lines and characters. If you’re adding both
lines and characters, making sure to set characters to 0 before calling
this function to ensure correct results.
Sourcefn set_character(&mut self, character: u32)
fn set_character(&mut self, character: u32)
Sets character to a specific value.
Sourcefn is_in_bounds(&self, start: Self, end: Self) -> bool
fn is_in_bounds(&self, start: Self, end: Self) -> bool
Checks whether or not this position is between the 2 passed positions.
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.