Struct lib_ruby_parser::Loc[][src]

#[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

Converts location to a range

Constructs a new Loc struct

Returns begin field of the Loc

Returns end field of the Loc

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

Returns a new Loc with given begin and current end

Returns a new Loc with given end and current begin

Adds given delta to begin

Adds given delta to end

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

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

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

Returns source code of the current Loc on a given Input

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.