enum-error-derive 0.1.1

Derive Error traits
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 6.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 258.61 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • termoshtt/procedurals
    12 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • termoshtt

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(())
}