Struct lib_ruby_parser::Loc
source · [−]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
sourceimpl 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
sourcepub fn source(&self, input: &DecodedInput) -> Option<String>
pub fn source(&self, input: &DecodedInput) -> Option<String>
Returns source code of the current Loc
on a given Input
Trait Implementations
impl Copy for Loc
impl Eq for Loc
impl StructuralEq for Loc
impl StructuralPartialEq for Loc
Auto Trait Implementations
impl RefUnwindSafe for Loc
impl Send for Loc
impl Sync for Loc
impl Unpin for Loc
impl UnwindSafe for Loc
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more