Generating error variant description from doc string.
creativcoder opened this issue · comments
creativcoder commented
Hi @dtolnay
So, I have the following error:
pub enum Err {
/// This is error one
#[error("This is error one")]
ErrorOne
}
which is exposed from my library.
Is there a way, I can write #[error(from_doc_string)]
or something similar over ErrorOne
which will generate the description from doc string itself? This way I don't have to type the same description twice.
David Tolnay commented
This not something I want to build into thiserror, but you can use #[derive(thiserror::Error, displaydoc::Display)] together.
https://github.com/yaahc/displaydoc