pub struct RustCode {
pub module: &'static str,
pub line: u32,
pub column: u32,
pub blame_fn: fn(&str),
}
Expand description
A component of RustOrigin that indicates a specific location in the Rust source code.
Fields§
§module: &'static str
The name of the Rust module.
line: u32
A one-based line number within the module file.
column: u32
A one-based column number within a line of the module file.
blame_fn: fn(&str)
A function that panics at the location of the pointed Rust construct with the specified error message.
Implementations§
Source§impl RustCode
impl RustCode
Sourcepub fn blame(&self, message: &str)
pub fn blame(&self, message: &str)
Similar to RustOrigin::blame. Refer to its documentation for details.
Sourcepub fn position(&self) -> Position
pub fn position(&self) -> Position
A helper function that returns a Position representation of the line and column of this RustCode.
Sourcepub fn span(&self) -> PositionSpan
pub fn span(&self) -> PositionSpan
Sourcepub fn span_string(&self) -> String
pub fn span_string(&self) -> String
A helper function that formats the line and column in the canonical
end-user-facing form of [<line>]:[<column>]
.
Trait Implementations§
Source§impl Ord for RustCode
impl Ord for RustCode
Source§impl PartialOrd for RustCode
impl PartialOrd for RustCode
impl Copy for RustCode
impl Eq for RustCode
Auto Trait Implementations§
impl Freeze for RustCode
impl RefUnwindSafe for RustCode
impl Send for RustCode
impl Sync for RustCode
impl Unpin for RustCode
impl UnwindSafe for RustCode
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> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read more