pub struct FileLocation {
pub path: Option<PathBuf>,
pub line: Option<usize>,
pub column: Option<usize>,
}Expand description
Location inside an input artefact, used by structured diagnostics.
Fields are 1-based when present (matching the convention of common text
editors and the format specifications themselves). path is None when
the input was a buffer rather than a named file.
§Examples
use siderust::formats::FileLocation;
let loc = FileLocation::new(Some("/data/igs.sp3".into()), Some(42), Some(7));
assert_eq!(loc.line, Some(42));
assert_eq!(loc.column, Some(7));
assert!(loc.path.as_ref().unwrap().ends_with("igs.sp3"));Fields§
§path: Option<PathBuf>Filesystem path, when known.
line: Option<usize>1-based line number, when known.
column: Option<usize>1-based column number, when known.
Implementations§
Trait Implementations§
Source§impl Clone for FileLocation
impl Clone for FileLocation
Source§fn clone(&self) -> FileLocation
fn clone(&self) -> FileLocation
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 moreSource§impl Debug for FileLocation
impl Debug for FileLocation
Source§impl Default for FileLocation
impl Default for FileLocation
Source§fn default() -> FileLocation
fn default() -> FileLocation
Returns the “default value” for a type. Read more
Source§impl Display for FileLocation
impl Display for FileLocation
impl Eq for FileLocation
Source§impl PartialEq for FileLocation
impl PartialEq for FileLocation
Source§fn eq(&self, other: &FileLocation) -> bool
fn eq(&self, other: &FileLocation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FileLocation
Auto Trait Implementations§
impl Freeze for FileLocation
impl RefUnwindSafe for FileLocation
impl Send for FileLocation
impl Sync for FileLocation
impl Unpin for FileLocation
impl UnsafeUnpin for FileLocation
impl UnwindSafe for FileLocation
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> UsingEngine for T
impl<T> UsingEngine for T
Source§fn using<'a, Ctx>(&'a self, engine: &'a Ctx) -> WithEngine<'a, Self, Ctx>where
Ctx: TransformContext,
fn using<'a, Ctx>(&'a self, engine: &'a Ctx) -> WithEngine<'a, Self, Ctx>where
Ctx: TransformContext,
Wrap this coordinate with a custom transform context for the next
transformation call.