-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
How can I write a displaydoc impl for the following struct?
#[displaydoc("{kind}: {str_context}")]
pub struct DataError {
/// Broad category of the error.
pub kind: DataErrorKind,
/// Additional context, if available.
pub str_context: Option<&'static str>,
}This errors out with:
`std::option::Option<&str>` cannot be formatted with the default formatter
What I would like is to make an error that contains ": {str_context}" when Some and nothing when None.
Do I need to manually implement Display, or can I use displaydoc?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels