pub struct SourceLocation {
pub repository: PathBuf,
pub file_path: PathBuf,
pub line: usize,
pub git_ref: Option<String>,
}Expand description
Tracks the file origin of an item for error reporting.
Fields§
§repository: PathBufRepository path (absolute).
file_path: PathBufRelative path within repository.
line: usizeLine number where item definition starts (1-indexed).
git_ref: Option<String>Optional Git commit/branch if reading from history.
Implementations§
Source§impl SourceLocation
impl SourceLocation
Sourcepub fn new(
repository: impl Into<PathBuf>,
file_path: impl Into<PathBuf>,
line: usize,
) -> Self
pub fn new( repository: impl Into<PathBuf>, file_path: impl Into<PathBuf>, line: usize, ) -> Self
Creates a new SourceLocation.
Sourcepub fn with_git_ref(
repository: impl Into<PathBuf>,
file_path: impl Into<PathBuf>,
line: usize,
git_ref: impl Into<String>,
) -> Self
pub fn with_git_ref( repository: impl Into<PathBuf>, file_path: impl Into<PathBuf>, line: usize, git_ref: impl Into<String>, ) -> Self
Creates a new SourceLocation with a Git reference.
Sourcepub fn display_full(&self) -> String
pub fn display_full(&self) -> String
Format with repository prefix.
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SourceLocation
impl Debug for SourceLocation
Source§impl<'de> Deserialize<'de> for SourceLocation
impl<'de> Deserialize<'de> for SourceLocation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SourceLocation
impl Display 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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