Struct holochain::prelude::kitsune_p2p::dependencies::kitsune_p2p_types::dependencies::lair_keystore_api::dependencies::hc_seed_bundle::dependencies::one_err::OneErr
source · pub struct OneErr(_);
Expand description
OneErr to rule them all. See crate docs for usage.
Implementations§
source§impl OneErr
impl OneErr
sourcepub fn with_message<K, M>(kind: K, message: M) -> OneErrwhere
K: Display,
M: Display,
pub fn with_message<K, M>(kind: K, message: M) -> OneErrwhere K: Display, M: Display,
Create a new OneErr error instance with a message.
sourcepub 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’.
sourcepub fn set_field<K, T>(&mut self, name: &K, t: T) -> &mut OneErrwhere
K: Display + ?Sized,
T: Into<Value>,
pub fn set_field<K, T>(&mut self, name: &K, t: T) -> &mut OneErrwhere K: Display + ?Sized, T: Into<Value>,
Set an additional data field on this OneErr. Will panic on reserved names: “error”, “os”, “source”, “backtrace”, “message”.
sourcepub 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 + Send + Sync + 'static)>
pub fn get_ref(&self) -> Option<&(dyn Error + Send + Sync + '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.
This may be a value set by Rust code constructing custom io::Error
s,
or if this io::Error
was sourced from the operating system,
it will be a value inferred from the system’s error encoding.
See last_os_error
for more details.
Examples
use std::io::{Error, ErrorKind};
fn print_error(err: Error) {
println!("{:?}", err.kind());
}
fn main() {
// As no error has (visibly) occurred, this may print anything!
// It likely prints a placeholder for unidentified (non-)errors.
print_error(Error::last_os_error());
// Will print "AddrInUse".
print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
}
Trait Implementations§
source§impl<'de> Deserialize<'de> for OneErr
impl<'de> Deserialize<'de> for OneErr
source§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>,
source§impl Error for OneErr
impl Error for OneErr
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl From<&OneErr> for SodokenErrKind
impl From<&OneErr> for SodokenErrKind
source§fn from(e: &OneErr) -> SodokenErrKind
fn from(e: &OneErr) -> SodokenErrKind
source§impl From<OneErr> for ConductorApiError
impl From<OneErr> for ConductorApiError
source§impl From<OneErr> for ConductorError
impl From<OneErr> for ConductorError
source§impl From<OneErr> for ScratchError
impl From<OneErr> for ScratchError
source§fn from(e: OneErr) -> ScratchError
fn from(e: OneErr) -> ScratchError
source§impl From<OneErr> for SourceChainError
impl From<OneErr> for SourceChainError
source§fn from(e: OneErr) -> SourceChainError
fn from(e: OneErr) -> SourceChainError
source§impl From<OneErr> for WorkflowError
impl From<OneErr> for WorkflowError
source§impl From<SodokenErrKind> for OneErr
impl From<SodokenErrKind> for OneErr
source§fn from(k: SodokenErrKind) -> OneErr
fn from(k: SodokenErrKind) -> OneErr
source§impl PartialEq<OneErr> for OneErr
impl PartialEq<OneErr> for OneErr
source§impl Serialize for OneErr
impl Serialize for OneErr
source§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,
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.