Skip to main content

Crate nexcore_error_derive

Crate nexcore_error_derive 

Source
Expand description

Derive macro for NexVigilant error types.

Drop-in replacement for thiserror::Error. Provides #[derive(Error)] with #[error("...")], #[from], and #[source] attributes.

§Usage

use nexcore_error_derive::Error;

#[derive(Debug, Error)]
pub enum MyError {
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),
    #[error("parse error: {msg}")]
    Parse { msg: String },
    #[error("not found")]
    NotFound,
}

Derive Macros§

Error
Derive Display and std::error::Error for an enum or struct.