Struct SourceLocation
pub struct SourceLocation {
pub file_pos: FilePosition,
pub length: u32,
}Expand description
The location and span of a token in the preprocessed translation unit.
Fields§
§file_pos: FilePosition§length: u32Implementations§
§impl SourceLocation
impl SourceLocation
pub fn new(file_pos: FilePosition, length: usize) -> Self
pub fn new(file_pos: FilePosition, length: usize) -> Self
Creates a new source location for the given file position and length in bytes.
pub fn none() -> Self
pub fn none() -> Self
Creates a new source location which indicates a ‘null’ / no value.
pub fn merge_with(self, other: SourceLocation) -> Self
pub fn merge_with(self, other: SourceLocation) -> Self
Merges this and the other location into a new location, taking the union of the two.
pub fn set_span_up_to_location(&mut self, other: &SourceLocation)
pub fn set_span_up_to_location(&mut self, other: &SourceLocation)
Modifies this location’s length so that this location’s span finishes immediately before the given other one
begins.
This function will shrink or extend this location’s length depending on the other one’s start position.
The other location must start after this one, or otherwise the operation is a no-op.
pub fn get_next_location(&self) -> SourceLocation
pub fn get_next_location(&self) -> SourceLocation
Gets the next source location, of length 1, after this one.
Trait Implementations§
§impl Clone for SourceLocation
impl Clone for SourceLocation
§fn clone(&self) -> SourceLocation
fn clone(&self) -> SourceLocation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for SourceLocation
impl Debug for SourceLocation
§impl Default for SourceLocation
impl Default for SourceLocation
§fn default() -> SourceLocation
fn default() -> SourceLocation
Returns the “default value” for a type. Read more
§impl Display for SourceLocation
impl Display for SourceLocation
§impl PartialEq for SourceLocation
impl PartialEq for SourceLocation
impl Copy for SourceLocation
impl Eq for SourceLocation
impl StructuralPartialEq for SourceLocation
Auto Trait Implementations§
impl Freeze for SourceLocation
impl RefUnwindSafe for SourceLocation
impl Send for SourceLocation
impl Sync for SourceLocation
impl Unpin for SourceLocation
impl UnwindSafe for SourceLocation
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