-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
source: save the source info when the user calls the macros
- Loading branch information
Showing
9 changed files
with
88 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! Source represent source info | ||
|
||
/// Source Info | ||
/// | ||
/// Save the source info when the user calls the macros. | ||
#[derive(Debug, Clone)] | ||
pub struct Source { | ||
/// File name in which it was invoked | ||
pub file: &'static str, | ||
|
||
/// line number on which it was invoked | ||
pub line: u32, | ||
|
||
/// Column number at which it was invoked | ||
pub column: u32, | ||
} | ||
|
||
impl Source { | ||
/// Create a new source info | ||
/// | ||
/// ``` | ||
/// let mut source = logkit::Source::new(file!(), line!(), column!()); | ||
/// assert_eq!(source.file, "src/source.rs"); | ||
/// assert!(source.line > 0); | ||
/// assert!(source.column > 0); | ||
/// ``` | ||
#[inline] | ||
pub fn new(file: &'static str, line: u32, column: u32) -> Self { | ||
Self {file, line, column} | ||
} | ||
} |