[][src]Trait status::Kind

pub trait Kind: Copy + Clone + Display + Debug + Send + Sync + 'static {
    fn into_status<C: Context>(self) -> Status<Self, C> { ... }
fn into_err<T, C: Context>(self) -> Result<T, Status<Self, C>> { ... } }

Trait alias for types that programmatically specify the status.

For prototyping, see Unkind.

Example

use status::Kind;

#[derive(Copy, Clone, Debug, derive_more::Display)]
enum ErrorKind {
  #[display(fmt = "Failed to read file")]
  Read,
  #[display(fmt = "Failed to parse")]
  Parse,
}
type Status = status::Status<ErrorKind>;
type Result<T, E = Status> = std::result::Result<T, E>;

fn read_file() -> Result<()> {
    return ErrorKind::Read.into_err();
}

Provided methods

fn into_status<C: Context>(self) -> Status<Self, C>

Convenience for creating an error.

fn into_err<T, C: Context>(self) -> Result<T, Status<Self, C>>

Convenience for returning an error.

Loading content...

Implementors

impl<U> Kind for U where
    U: Copy + Clone + Display + Debug + Send + Sync + 'static, 
[src]

Loading content...