pub enum GlommioError<T> {
    IoError(Error),
    EnhancedIoError {
        source: Error,
        op: &'static str,
        path: Option<PathBuf>,
        fd: Option<RawFd>,
    },
    ExecutorError(ExecutorErrorKind),
    BuilderError(BuilderErrorKind),
    Closed(ResourceType<T>),
    CanNotBeClosed(ResourceType<T>, &'static str),
    WouldBlock(ResourceType<T>),
    ReactorError(ReactorErrorKind),
    TimedOut(Duration),
}
Expand description

Composite error type to encompass all error types glommio produces.

Single error type that will be produced by any public Glommio API functions. Contains a generic type that is only used for the Channel variants. In other cases it can just be replaced with the unit type () and ignored. The variants are broken up into a few common categories such as Closed and WouldBlock as well as a generic IoError and errors dedicated to the executor and reactor.

§Examples

use glommio::{GlommioError, ResourceType};

fn will_error() -> Result<(), GlommioError<()>> {
    Err(GlommioError::WouldBlock(ResourceType::File(
        "Error reading a file".to_string(),
    )))?
}
assert!(will_error().is_err());

Variants§

§

IoError(Error)

IO error from standard library functions or libraries that produce std::io::Error’s.

§

EnhancedIoError

Fields

§source: Error

The source error from std::io::Error.

§op: &'static str

The operation that was being attempted.

§path: Option<PathBuf>

The path of the file, if relevant.

§fd: Option<RawFd>

The numeric file descriptor of the relevant resource.

Enhanced IO error that gives more information in the error message than the basic IoError. It includes the operation, path and file descriptor. It also contains the error from the source IO error from std::io::*.

§

ExecutorError(ExecutorErrorKind)

Executor error variant(s) for signaling certain error conditions inside the executor.

§

BuilderError(BuilderErrorKind)

Error variant(s) produced when building executors.

§

Closed(ResourceType<T>)

The resource in question is closed. Generic because the channel variant needs to return the actual item sent into the channel.

§

CanNotBeClosed(ResourceType<T>, &'static str)

The resource can not be closed because certain conditions are not satisfied

§

WouldBlock(ResourceType<T>)

Error encapsulating the WouldBlock error for types that don’t have errors originating in the standard library. Glommio also has nonblocking types that need to indicate if they are blocking or not. This type allows for signaling when a function would otherwise block for a specific ResourceType.

§

ReactorError(ReactorErrorKind)

Reactor error variants. This includes errors specific to the operation of the io-uring instances or related.

§

TimedOut(Duration)

Timeout variant used for reporting timed out operations

Implementations§

source§

impl<T> GlommioError<T>

source

pub fn raw_os_error(&self) -> Option<i32>

Returns the OS error that this error represents (if any).

If this Error was constructed from an io::Error which encapsulates a raw OS error, then this function will return Some, otherwise it will return None.

Trait Implementations§

source§

impl<T> Display for GlommioError<T>

source§

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

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

impl<T> Error for GlommioError<T>

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<T> From<(Error, ResourceType<T>)> for GlommioError<T>

source§

fn from(tuple: (Error, ResourceType<T>)) -> Self

Converts to this type from the input type.
source§

impl<T> From<Error> for GlommioError<T>

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl<T> From<GlommioError<T>> for Error

source§

fn from(err: GlommioError<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for GlommioError<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for GlommioError<T>

§

impl<T> Send for GlommioError<T>
where T: Send,

§

impl<T> !Sync for GlommioError<T>

§

impl<T> Unpin for GlommioError<T>
where T: Unpin,

§

impl<T> !UnwindSafe for GlommioError<T>

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
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