Closed
Description
Since Rust has introduced #[default]
, can we hightlight it in the doc?
Like this one:
#[derive(Default)]
enum Status {
#[default]
Active,
Inactive,
}
For other type of default definition of enums, it can be hard! For example, the following code, can be hard:
#[derive(...)]
enum Status {
Active,
Inactive,
}
impl Default for Status {
fn default() -> Self {
serde::from_str("active").unwrap()
}
}
or:
#[derive(...)]
enum Status {
Active,
Inactive,
}
impl Default for Status {
fn default() -> Self {
if env!("ENV") == "prod" {
Self::Inactive
} else {
Self::Active
}
}
}
We can ignore these cases.
Metadata
Metadata
Assignees
Labels
No labels