Struct lair_keystore::dependencies::one_err::OneErr
[−]pub struct OneErr(_);
Expand description
OneErr to rule them all. See crate docs for usage.
Implementations
impl OneErr
impl OneErr
pub fn with_message<K, M>(kind: K, message: M) -> OneErr where
K: Display,
M: Display,
pub fn with_message<K, M>(kind: K, message: M) -> OneErr where
K: Display,
M: Display,
Create a new OneErr error instance with a message.
pub fn str_kind(&self) -> &str
pub fn str_kind(&self) -> &str
Get the &str kind associated with this instance.
This can be more descriptive where io_kind()
or errno()
might return ‘Other’.
pub fn set_field<K, T>(&mut self, name: &K, t: T) -> &mut OneErr where
K: Display + ?Sized,
T: Into<Value>,
pub fn set_field<K, T>(&mut self, name: &K, t: T) -> &mut OneErr where
K: Display + ?Sized,
T: Into<Value>,
Set an additional data field on this OneErr. Will panic on reserved names: “error”, “os”, “source”, “backtrace”, “message”.
pub fn get_message(&self) -> Option<&str>
pub fn get_message(&self) -> Option<&str>
Get the message associated with this instance, or empty string.
Methods from Deref<Target = Error>
1.0.0 · sourcepub fn raw_os_error(&self) -> Option<i32>
pub fn raw_os_error(&self) -> Option<i32>
Returns the OS error that this error represents (if any).
If this Error
was constructed via last_os_error
or
from_raw_os_error
, then this function will return Some
, otherwise
it will return None
.
Examples
use std::io::{Error, ErrorKind};
fn print_os_error(err: &Error) {
if let Some(raw_os_err) = err.raw_os_error() {
println!("raw OS error: {raw_os_err:?}");
} else {
println!("Not an OS error");
}
}
fn main() {
// Will print "raw OS error: ...".
print_os_error(&Error::last_os_error());
// Will print "Not an OS error".
print_os_error(&Error::new(ErrorKind::Other, "oh no!"));
}
1.3.0 · sourcepub fn get_ref(&self) -> Option<&(dyn Error + Sync + Send + 'static)>
pub fn get_ref(&self) -> Option<&(dyn Error + Sync + Send + 'static)>
Returns a reference to the inner error wrapped by this error (if any).
If this Error
was constructed via new
then this function will
return Some
, otherwise it will return None
.
Examples
use std::io::{Error, ErrorKind};
fn print_error(err: &Error) {
if let Some(inner_err) = err.get_ref() {
println!("Inner error: {inner_err:?}");
} else {
println!("No inner error");
}
}
fn main() {
// Will print "No inner error".
print_error(&Error::last_os_error());
// Will print "Inner error: ...".
print_error(&Error::new(ErrorKind::Other, "oh no!"));
}
1.0.0 · sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Returns the corresponding ErrorKind
for this error.
Examples
use std::io::{Error, ErrorKind};
fn print_error(err: Error) {
println!("{:?}", err.kind());
}
fn main() {
// Will print "Uncategorized".
print_error(Error::last_os_error());
// Will print "AddrInUse".
print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
}
Trait Implementations
impl<'de> Deserialize<'de> for OneErr
impl<'de> Deserialize<'de> for OneErr
fn deserialize<D>(
deserializer: D
) -> Result<OneErr, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<OneErr, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Error for OneErr
impl Error for OneErr
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
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl<'_> From<&'_ OneErr> for SodokenErrKind
impl<'_> From<&'_ OneErr> for SodokenErrKind
fn from(e: &OneErr) -> SodokenErrKind
fn from(e: &OneErr) -> SodokenErrKind
Converts to this type from the input type.
impl From<SodokenErrKind> for OneErr
impl From<SodokenErrKind> for OneErr
fn from(k: SodokenErrKind) -> OneErr
fn from(k: SodokenErrKind) -> OneErr
Converts to this type from the input type.
impl Serialize for OneErr
impl Serialize for OneErr
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for OneErr
Auto Trait Implementations
impl !RefUnwindSafe for OneErr
impl Send for OneErr
impl Sync for OneErr
impl Unpin for OneErr
impl !UnwindSafe for OneErr
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
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more