-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Problem
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.
Proposed Solution
No response
Notes
No response
pitdicker, joshka and sorairolake
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.