Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/edition/src/lib.rs')
| -rw-r--r-- | crates/edition/src/lib.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/edition/src/lib.rs b/crates/edition/src/lib.rs index a2269bf54d..04e65fc378 100644 --- a/crates/edition/src/lib.rs +++ b/crates/edition/src/lib.rs @@ -41,6 +41,15 @@ impl Edition { self >= Edition::Edition2018 } + pub fn number(&self) -> usize { + match self { + Edition::Edition2015 => 2015, + Edition::Edition2018 => 2018, + Edition::Edition2021 => 2021, + Edition::Edition2024 => 2024, + } + } + pub fn iter() -> impl Iterator<Item = Edition> { [Edition::Edition2015, Edition::Edition2018, Edition::Edition2021, Edition::Edition2024] .iter() |