Expand description
A wrapper around pieces of data extracted from NSError
. This could be improved: right now, it
allocates String
instances when theoretically it could be avoided, and we might be erasing
certain parts of the NSError
object that are useful.
Fields
code: usize
Represents the code. Some of these can be… archaic.
domain: String
Represents the domain of the error.
description: String
Maps over to [NSError localizedDescription]
.
Implementations
sourceimpl Error
impl Error
sourcepub fn new(error: id) -> Self
pub fn new(error: id) -> Self
Given an NSError
(i.e, an id reference) we’ll pull out the relevant information and
configure this. We pull out the information as it makes the error thread safe this way,
which is… easier, in some cases.
sourcepub fn into_nserror(self) -> id
pub fn into_nserror(self) -> id
Used for cases where we need to return an NSError
back to the system (e.g, top-level
error handling). We just create a new NSError
so the Error
crate can be mostly
thread safe.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
1.30.0 · sourcefn 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 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more