pub struct OneErr(/* private fields */);
Expand description

OneErr to rule them all. See crate docs for usage.

Implementations§

source§

impl OneErr

source

pub fn new<K>(kind: K) -> OneErr
where K: Display,

Create a new OneErr error instance.

source

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.

source

pub fn io_kind(&self) -> ErrorKind

Get the std::io::ErrorKind associated with this instance.

source

pub fn errno(&self) -> ErrNo

Get the ErrNo associated with this instance, if any.

source

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’.

source

pub fn as_io(&self) -> &Error

Get a reference to the inner std::io::Error of this instance.

source

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”.

source

pub fn get_message(&self) -> Option<&str>

Get the message associated with this instance, or empty string.

source

pub fn get_field<'lt, R, V>(&'lt self, name: R) -> Option<V>
where R: AsRef<str>, Option<V>: From<&'lt Value>,

Get the value of an additional field associated with this error, or None if no such field exists. Valid output types: &str, bool, i64, u64, and f64.

Methods from Deref<Target = Error>§

1.0.0 · source

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 · source

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 · source

pub fn kind(&self) -> ErrorKind

Returns the corresponding ErrorKind for this error.

This may be a value set by Rust code constructing custom io::Errors, 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 AsRef<Error> for OneErr

source§

fn as_ref(&self) -> &Error

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for OneErr

source§

fn clone(&self) -> OneErr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for OneErr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Deref for OneErr

§

type Target = Error

The resulting type after dereferencing.
source§

fn deref(&self) -> &<OneErr as Deref>::Target

Dereferences the value.
source§

impl<'de> Deserialize<'de> for OneErr

source§

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
source§

impl Display for OneErr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Error for OneErr

1.30.0 · source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<&OneErr> for Error

source§

fn from(e: &OneErr) -> Error

Converts to this type from the input type.
source§

impl From<&OneErr> for SodokenErrKind

source§

fn from(e: &OneErr) -> SodokenErrKind

Converts to this type from the input type.
source§

impl From<&String> for OneErr

source§

fn from(s: &String) -> OneErr

Converts to this type from the input type.
source§

impl From<&str> for OneErr

source§

fn from(s: &str) -> OneErr

Converts to this type from the input type.
source§

impl From<()> for OneErr

source§

fn from(_: ()) -> OneErr

Converts to this type from the input type.
source§

impl From<ErrNo> for OneErr

source§

fn from(e: ErrNo) -> OneErr

Converts to this type from the input type.
source§

impl From<Error> for OneErr

source§

fn from(e: Error) -> OneErr

Converts to this type from the input type.
source§

impl From<ErrorKind> for OneErr

source§

fn from(k: ErrorKind) -> OneErr

Converts to this type from the input type.
source§

impl From<OneErr> for CellError

source§

fn from(source: OneErr) -> Self

Converts to this type from the input type.
source§

impl From<OneErr> for ChcError

source§

fn from(source: OneErr) -> ChcError

Converts to this type from the input type.
source§

impl From<OneErr> for ConductorApiError

source§

fn from(e: OneErr) -> Self

Converts to this type from the input type.
source§

impl From<OneErr> for ConductorError

source§

fn from(e: OneErr) -> Self

Converts to this type from the input type.
source§

impl From<OneErr> for Error

source§

fn from(e: OneErr) -> Error

Converts to this type from the input type.
source§

impl From<OneErr> for ScratchError

source§

fn from(e: OneErr) -> ScratchError

Converts to this type from the input type.
source§

impl From<OneErr> for SourceChainError

source§

fn from(e: OneErr) -> SourceChainError

Converts to this type from the input type.
source§

impl From<OneErr> for WorkflowError

source§

fn from(e: OneErr) -> Self

Converts to this type from the input type.
source§

impl From<SodokenErrKind> for OneErr

source§

fn from(k: SodokenErrKind) -> OneErr

Converts to this type from the input type.
source§

impl From<String> for OneErr

source§

fn from(s: String) -> OneErr

Converts to this type from the input type.
source§

impl From<i32> for OneErr

source§

fn from(e: i32) -> OneErr

Converts to this type from the input type.
source§

impl FromStr for OneErr

§

type Err = OneErr

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<OneErr, <OneErr as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq for OneErr

source§

fn eq(&self, oth: &OneErr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for OneErr

source§

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
source§

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<T> Error for T
where T: Error + 'static,

§

fn as_error(&self) -> &(dyn Error + 'static)

Gets this error as an std::error::Error.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> State for T
where T: Debug + Clone + Send + Sync,