Struct lib_ruby_parser::Loc[][src]

#[repr(C)]pub struct Loc {
    pub begin: usize,
    pub end: usize,
}

Fields

begin: usize

Begin of the Loc range

end: usize

End of the Loc range

Implementations

impl Loc[src]

pub fn new(begin: usize, end: usize) -> LocPtr[src]

Constructs a new Loc struct

pub fn begin(&self) -> LocPtr[src]

Returns begin field of the Loc

pub fn end(&self) -> LocPtr[src]

Returns end field of the Loc

pub fn size(&self) -> usize[src]

Returns size of the Loc (i.e. end - begin)

pub fn with_begin(&self, begin: usize) -> LocPtr[src]

Returns a new Loc with given begin and current end

pub fn with_end(&self, end: usize) -> LocPtr[src]

Returns a new Loc with given end and current begin

pub fn adjust_begin(&self, delta: i32) -> LocPtr[src]

Adds given delta to begin

pub fn adjust_end(&self, d: i32) -> LocPtr[src]

Adds given delta to end

pub fn resize(&self, new_size: usize) -> LocPtr[src]

Returns a new Loc with the same begin, but adjusted end, so that its size is equal to given new_size

pub fn join(&self, other: &Self) -> LocPtr[src]

Joins two Locs by choosing min(begin) + max(end)

pub fn is_empty(&self) -> bool[src]

Returns true if Loc is empty (i.e. begin == end)

pub fn source(&self, input: &Input) -> Option<String>[src]

Returns source code of the current Loc on a given Input

impl Loc[src]

pub fn to_range(&self) -> Range<usize>[src]

Converts location to a range

Trait Implementations

impl Clone for Loc[src]

impl Debug for Loc[src]

impl Default for Loc[src]

impl PartialEq<Loc> for Loc[src]

impl StructuralPartialEq for Loc[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.