pub struct SourceLocation { /* private fields */ }Expand description
Represents a location in source code using one-based line and column numbers.
Implementations§
Source§impl SourceLocation
impl SourceLocation
Sourcepub const fn new(line: usize, column: usize) -> Self
pub const fn new(line: usize, column: usize) -> Self
Builds a new location.
§Examples
use whitaker_common::span::SourceLocation;
let location = SourceLocation::new(3, 5);
assert_eq!(location.line(), 3);Sourcepub const fn is_after(self, other: SourceLocation) -> bool
pub const fn is_after(self, other: SourceLocation) -> bool
Returns true when this location is positioned after other.
Trait Implementations§
Source§impl Clone for SourceLocation
impl Clone for SourceLocation
Source§fn clone(&self) -> SourceLocation
fn clone(&self) -> SourceLocation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SourceLocation
Source§impl Debug for SourceLocation
impl Debug for SourceLocation
impl Eq for SourceLocation
Source§impl PartialEq for SourceLocation
impl PartialEq 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 UnsafeUnpin 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