2 releases

Uses old Rust 2015

0.1.1 Mar 12, 2017
0.1.0 Mar 12, 2017

#217 in #proc-macro

Download history 9/week @ 2022-01-18 15/week @ 2022-01-25 6/week @ 2022-02-01 8/week @ 2022-02-08 9/week @ 2022-02-15 9/week @ 2022-02-22 11/week @ 2022-03-01 8/week @ 2022-03-08 14/week @ 2022-03-15 13/week @ 2022-03-22 8/week @ 2022-03-29 12/week @ 2022-04-05 9/week @ 2022-04-12 11/week @ 2022-04-19 18/week @ 2022-04-26 18/week @ 2022-05-03

57 downloads per month

MIT license

4KB
76 lines

enum-error-derive

Build Status

Derive Error traits for Enum Error struct

Example

#[macro_use]
extern crate enum_error_derive;

use std::{io, fmt};

#[derive(Debug, EnumError)] // EnumError derives From<*>, fmt::Display and error::Error
pub enum Error {
    IO(io::Error),
    Fmt(fmt::Error),
}

fn io_error() -> Result<(), io::Error> {
    Ok(())
}

fn fmt_error() -> Result<(), fmt::Error> {
    Ok(())
}

fn merged_error() -> Result<(), Error> {
    io_error()?;
    fmt_error()?;
    Ok(())
}

Dependencies

~1.5MB
~38K SLoC