#[repr(C)]pub struct Loc {
pub begin: usize,
pub end: usize,
}Expand description
Representation of any location in the given input
Fields§
§begin: usizeBegin of the Loc range
end: usizeEnd of the Loc range
Implementations§
Source§impl Loc
impl Loc
Sourcepub fn with_begin(&self, begin: usize) -> Loc
pub fn with_begin(&self, begin: usize) -> Loc
Returns a new Loc with given begin and current end
Sourcepub fn adjust_begin(&self, delta: i32) -> Loc
pub fn adjust_begin(&self, delta: i32) -> Loc
Adds given delta to begin
Sourcepub fn adjust_end(&self, d: i32) -> Loc
pub fn adjust_end(&self, d: i32) -> Loc
Adds given delta to end
Sourcepub fn resize(&self, new_size: usize) -> Loc
pub fn resize(&self, new_size: usize) -> Loc
Returns a new Loc with the same begin, but adjusted end,
so that its size is equal to given new_size
pub fn maybe_join(&self, other: &Option<Loc>) -> Loc
pub fn print(&self, name: &str)
Trait Implementations§
Source§impl LocExt for Loc
impl LocExt for Loc
Source§fn source(&self, input: &DecodedInput) -> Option<String>
fn source(&self, input: &DecodedInput) -> Option<String>
Returns source code of the current Loc on a given Input
Source§fn begin_line_col(&self, input: &DecodedInput) -> Option<(usize, usize)>
fn begin_line_col(&self, input: &DecodedInput) -> Option<(usize, usize)>
Returns line and column of the
begin of the Loc on a given InputSource§fn expand_to_line(&self, input: &DecodedInput) -> Option<(usize, Loc)>
fn expand_to_line(&self, input: &DecodedInput) -> Option<(usize, Loc)>
Expands
Loc to the whole line and returns line number and new Locimpl Copy for Loc
impl Eq for Loc
impl StructuralPartialEq for Loc
Auto Trait Implementations§
impl Freeze for Loc
impl RefUnwindSafe for Loc
impl Send for Loc
impl Sync for Loc
impl Unpin for Loc
impl UnwindSafe for Loc
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