pub struct GenericError { /* private fields */ }Expand description
The most generic Error type. This can be used if no specific error type will be implemented and returning an erro only containing an error message is sufficient.
§Example
fn some_function() -> Result<(), BoxError> {
Err(
GenericError::with_message("Some Message").into()
)
}Implementations§
Source§impl GenericError
impl GenericError
Sourcepub fn default() -> Self
pub fn default() -> Self
Create a GenericError that does not even contain a custom message
§Example
fn some_function() -> Result<(), BoxError> {
Err(
GenericError::default().into()
)
}Sourcepub fn with_message(message: &str) -> Self
pub fn with_message(message: &str) -> Self
Crate a GenericError containing the custom error message
§Example
fn some_function() -> Result<(), BoxError> {
Err(
GenericError::with_message("Some Message").into()
)
}Trait Implementations§
Source§impl Debug for GenericError
impl Debug for GenericError
Source§impl Display for GenericError
impl Display for GenericError
Auto Trait Implementations§
impl Freeze for GenericError
impl RefUnwindSafe for GenericError
impl Send for GenericError
impl Sync for GenericError
impl Unpin for GenericError
impl UnwindSafe for GenericError
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