pub struct SourceLocation {
pub file: &'static str,
pub line: u32,
pub column: u32,
}Expand description
The location of source code at a point in the codebase.
This should generally be constructed by using the [current_location] macro.
§Example
Basic Use:
#[doc(hidden)]
pub fn _inner_log(message: &str, location: astd::SourceLocation) {
println!("{}: {}", location, message)
}
macro_rules! log {
($($arg:tt)*) => {
_inner_log($($arg)*, astd::current_location!())
};
}
// ...
// Implicitly captures source-location at the same time
log!("logging something with source location...");Fields§
§file: &'static strThe path to the file
line: u32The line within the file
column: u32The column
Trait Implementations§
source§impl Debug for SourceLocation
impl Debug for SourceLocation
source§impl Default for SourceLocation
impl Default for SourceLocation
source§fn default() -> SourceLocation
fn default() -> SourceLocation
Returns the “default value” for a type. Read more
source§impl Display for SourceLocation
impl Display for SourceLocation
source§impl Ord for SourceLocation
impl Ord for SourceLocation
source§fn cmp(&self, other: &SourceLocation) -> Ordering
fn cmp(&self, other: &SourceLocation) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for SourceLocation
impl PartialEq for SourceLocation
source§impl PartialOrd for SourceLocation
impl PartialOrd 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