Struct lib_ruby_parser::Loc
source · #[repr(C)]pub struct Loc {
pub begin: usize,
pub end: usize,
}
Expand description
Representation of any location in the given input
Fields§
§begin: usize
Begin of the Loc
range
end: usize
End 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 Input
source§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 Loc
impl 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