| Crates.io | month-and-season |
| lib.rs | month-and-season |
| version | 0.1.0 |
| created_at | 2024-12-11 21:07:45.033563+00 |
| updated_at | 2024-12-11 21:07:45.033563+00 |
| description | Typed enumerations and utilities for months and meteorological seasons. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1480535 |
| size | 16,498 |
month-and-season is a Rust library that provides typed enumerations for the 12 months of the year and the 4 meteorological seasons, along with utilities for converting between them, iterating through them, and performing basic navigation.
Features:
Month enumeration:
Month."January" <-> Month::January).next() and previous().Season enumeration:
Season from a given Month using Season::from_month()."Autumn" <-> Season::Autumn).Season::months().Example Usage:
use month_and_season::{Month, Season};
use std::str::FromStr;
fn main() {
let m = Month::March;
println!("Month: {}", m);
let s = Season::from_month(m);
println!("Season for March: {}", s);
let parsed_month = Month::from_str("October").unwrap();
println!("Parsed month: {}", parsed_month);
let parsed_season = Season::from_str("Winter").unwrap();
println!("Parsed season: {}", parsed_season);
println!("All months in Summer: {:?}", Season::Summer.months());
println!("Next month after December: {}", Month::December.next());
}