pub struct Error(/* private fields */);Expand description
Represents an error with additional location information.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new<T>(
error: T,
file: &'static str,
line: u32,
func: &'static str,
module: &'static str,
) -> Self
pub fn new<T>( error: T, file: &'static str, line: u32, func: &'static str, module: &'static str, ) -> Self
Sourcepub fn chain<T>(
error: T,
file: &'static str,
line: u32,
func: &'static str,
module: &'static str,
) -> Self
pub fn chain<T>( error: T, file: &'static str, line: u32, func: &'static str, module: &'static str, ) -> Self
Chains an error with additional location information.
If the provided error is not of type Error, it creates a new Error with location information. If the provided error is of type Error, it adds the location information if it was not created by Error::plain.
§Parameters
error: The error to wrap.file: The file where the error occurred.line: The line number where the error occurred.func: The function where the error occurred.module: The module where the error occurred.
pub fn context(self, context: impl ToString) -> Self
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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