Enum solang_parser::pt::Loc
source · pub enum Loc {
Builtin,
CommandLine,
Implicit,
Codegen,
File(usize, usize, usize),
}
Expand description
A code location.
Variants§
Builtin
Builtin
CommandLine
Command line
Implicit
Implicit
Codegen
Codegen
File(usize, usize, usize)
The file number, start offset and end offset in bytes of the source file.
Implementations§
source§impl Loc
impl Loc
sourcepub fn begin_range(&self) -> Self
pub fn begin_range(&self) -> Self
Returns this location’s beginning range.
sourcepub fn try_file_no(&self) -> Option<usize>
pub fn try_file_no(&self) -> Option<usize>
Returns this location’s file number if it is a file, otherwise None
.
sourcepub fn exclusive_end(&self) -> usize
pub fn exclusive_end(&self) -> usize
Returns this location’s end. The returned endpoint is not part of the range. This is used when a half-open range is needed.
§Panics
If this location is not a file.
sourcepub fn use_start_from(&mut self, other: &Loc)
pub fn use_start_from(&mut self, other: &Loc)
sourcepub fn use_end_from(&mut self, other: &Loc)
pub fn use_end_from(&mut self, other: &Loc)
sourcepub fn with_start_from(self, other: &Self) -> Self
pub fn with_start_from(self, other: &Self) -> Self
sourcepub fn with_end_from(self, other: &Self) -> Self
pub fn with_end_from(self, other: &Self) -> Self
sourcepub fn with_start(self, start: usize) -> Self
pub fn with_start(self, start: usize) -> Self
Trait Implementations§
source§impl OptionalCodeLocation for Loc
impl OptionalCodeLocation for Loc
source§impl Ord for Loc
impl Ord for Loc
source§impl PartialOrd for Loc
impl PartialOrd for Loc
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl 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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more