Derive Macro amplify::Error [−][src]
#[derive(Error)]
Expand description
Error derive macro works to the full extend only when other derive macros
are used. With #[derive(Display)]
and [display(doc_comments)]
it uses
doc comments for generating error descriptions; with #[derive(From)]
it
may automatically implement transofrations from other error types.
Example
#[derive(Debug, Display, Error)] #[display(doc_comments)] enum Error { /// I/O operation error Io, /// Math overflow Overflow, /// Zero division with {0} ZeroDivision(u16), } assert_eq!(format!("{}", Error::Io), "I/O operation error"); assert_eq!(format!("{}", Error::Overflow), "Math overflow"); assert_eq!( format!("{}", Error::ZeroDivision(2)), "Zero division with 2" );