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

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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.