pub struct Location { /* private fields */ }Expand description
A serializable source code location.
This is meant to be a drop in replacement for std::panic::Location
with the added benefit that it implements Serialize and Deserialize.
In practice, this is useful when you want to capture caller information and store it, send it across process boundaries, or include it in serialized data.
For behavior and semantics, see std::panic::Location.
Implementations§
Source§impl Location
impl Location
Sourcepub const fn caller() -> Self
pub const fn caller() -> Self
Returns the caller location.
See std::panic::Location::caller for details.
Sourcepub const fn file(&self) -> &str
pub const fn file(&self) -> &str
Returns the file name.
See std::panic::Location::file for details.
Sourcepub const fn column(&self) -> u32
pub const fn column(&self) -> u32
Returns the column number.
See std::panic::Location::column for details.
Sourcepub const fn line(&self) -> u32
pub const fn line(&self) -> u32
Returns the line number.
See std::panic::Location::line for details.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Location
impl<'de> Deserialize<'de> for Location
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>,
Source§impl From<&'static Location<'static>> for Location
Converts a static std::panic::Location into a Location.
impl From<&'static Location<'static>> for Location
Converts a static std::panic::Location into a Location.
std::panic::Location::caller() returns a 'static location, so this
conversion can borrow the file path without allocating.
Source§impl Ord for Location
impl Ord for Location
Source§impl PartialOrd for Location
impl PartialOrd for Location
impl Eq for Location
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl Freeze for Location
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnsafeUnpin for Location
impl UnwindSafe for Location
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToLeanString for Twhere
T: Display,
impl<T> ToLeanString for Twhere
T: Display,
Source§fn try_to_lean_string(&self) -> Result<LeanString, ToLeanStringError>
fn try_to_lean_string(&self) -> Result<LeanString, ToLeanStringError>
LeanString. Read moreSource§fn to_lean_string(&self) -> LeanString
fn to_lean_string(&self) -> LeanString
LeanString. Read more