Trait TakeError

Source
pub trait TakeError {
    type Ok: Error + Send + Sync;
    type Err: Error + Send + Sync;

    // Required method
    fn take_error(&self) -> Result<Option<Self::Ok>, Self::Err>;
}
Expand description

Extract an error from the underlying struct that isn’t propagated through regular channels.

This is common in TcpListener / UdsStream structs where this trait can be used to access the SO_ERROR option on the socket.

Both Ok and Err are error types. If no error exists take_error should return Ok(None).

Required Associated Types§

Source

type Ok: Error + Send + Sync

The type of successful values yielded by this trait.

Source

type Err: Error + Send + Sync

The type of failures yielded by this trait.

Required Methods§

Source

fn take_error(&self) -> Result<Option<Self::Ok>, Self::Err>

Return an underlying error value of the struct.

Implementors§