Struct uucore::error::USimpleError
source · pub struct USimpleError {
pub code: i32,
pub message: String,
}
Expand description
A simple error type with an exit code and a message that implements UError
.
use uucore::error::{UResult, USimpleError};
let err = USimpleError { code: 1, message: "error!".into()};
let res: UResult<()> = Err(err.into());
// or using the `new` method:
let res: UResult<()> = Err(USimpleError::new(1, "error!"));
Fields§
§code: i32
§message: String
Implementations§
Trait Implementations§
source§impl Debug for USimpleError
impl Debug for USimpleError
source§impl Display for USimpleError
impl Display for USimpleError
source§impl Error for USimpleError
impl Error for USimpleError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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 RefUnwindSafe for USimpleError
impl Send for USimpleError
impl Sync for USimpleError
impl Unpin for USimpleError
impl UnwindSafe for USimpleError
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