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: i32Exit code of the error.
message: StringError message.
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)>
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 USimpleError
impl RefUnwindSafe for USimpleError
impl Send for USimpleError
impl Sync for USimpleError
impl Unpin for USimpleError
impl UnsafeUnpin 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