#macro #error #enums #auto #misc #error-enum #from-error

err

A few macros & misc that make using rust's Error infrastructure more convenient

8 releases

Uses old Rust 2015

0.0.8 Apr 3, 2015
0.0.7 Mar 4, 2015
0.0.4 Feb 26, 2015

#10 in #misc

Download history 9/week @ 2024-05-30 8/week @ 2024-06-06 5/week @ 2024-06-13 5/week @ 2024-06-20 4/week @ 2024-06-27 19/week @ 2024-07-04 2/week @ 2024-07-11 1/week @ 2024-07-18 9/week @ 2024-07-25 8/week @ 2024-08-01

84 downloads per month
Used in dev

MIT license

5KB
133 lines

err

A collection of macros for working with FromError, the most useful of which is error_enum!

#[macro_use]
extern crate err;

error_enum! {
	enum MyError {
		bare SomethingCustom(&'static str),
		auto Io(std::io::Error)
	}

	enum MyOtherError {
		auto MyError(MyError)
	}
}

// An all the elements marked `auto` have auto-generated FromError
// implimentations created with the assumption that they are simple wrappers
// around a type.

Limitations

  • No-arg enum elements are not supported
  • Trailing commas on the last enum element are not supported

No runtime deps