### Example calling a_crate::a_func in examples/ex.rs Source: https://docs.rs/datetimeutils/latest/scrape-examples-help.html Shows how an example file calls the public function, which Rustdoc will include in the documentation for that function. ```rust // examples/ex.rs fn main() { a_crate::a_func(); } ``` -------------------------------- ### Get current year and days in year with datetimeutils Source: https://docs.rs/datetimeutils/latest/src/year_days/year_days.rs.html Uses PostEpochTime::now() to get the current time and days_in_year() to determine the number of days in the current year. Prints the year and day count. ```rust use datetimeutils::{PostEpochTime, days_in_year}; fn main() { let now = PostEpochTime::now().unwrap(); println!("The current year is {}, which has {} days", now.year(), days_in_year(now.year())); } ``` -------------------------------- ### Calculate days in a year Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.days_in_year.html This example demonstrates how to use days_in_year to determine the number of days in the current year. ```rust 3fn main() { 4 let now = PostEpochTime::now().unwrap(); 5 println!("The current year is {}, which has {} days", now.year(), days_in_year(now.year())); 6} ``` -------------------------------- ### Public function in src/lib.rs Source: https://docs.rs/datetimeutils/latest/scrape-examples-help.html Defines a public function that can be documented and scraped for examples. ```rust // src/lib.rs pub fn a_func() {} ``` -------------------------------- ### PostEpochTime::from Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Creates a PostEpochTime from a SystemTime. The SystemTime must be after the Unix epoch, otherwise an error is returned. ```APIDOC ## PostEpochTime::from ### Description Creates a `PostEpochTime` from a `SystemTime`. The `SystemTime` must be temporally in the future relative to the unix epoch, or an error will be returned. ### Method `pub fn from(st: &SystemTime) -> Result` ### Parameters - **st** (`&SystemTime`) - Required - The system time to convert. ### Returns - `Result` - A `PostEpochTime` instance or a `SystemTimeError` if the time is before the epoch. ``` -------------------------------- ### PostEpochTime::now Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Creates a PostEpochTime for the current instant. The current instant must be after the Unix epoch, otherwise an error is returned. ```APIDOC ## PostEpochTime::now ### Description Creates a `PostEpochTime` for the current instant. The current instant must be in the future relative to the unix epoch, or an error will be returned. ### Method `pub fn now() -> Result` ### Returns - `Result` - A `PostEpochTime` instance for the current time or a `SystemTimeError` if the current time is before the epoch. ``` -------------------------------- ### PostEpochTime time component methods Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Methods to calculate the minute and second within their respective time units. ```rust /// Returns the minute within the hour (0-indexed). This will be in the range /// 0..59 (inclusive). pub fn minute(&self) -> u64 { self.second_in_hour() / seconds_in_minute() } /// Returns the second within the minute (0-indexed). This will be in the range /// 0..59 (inclusive). pub fn second(&self) -> u64 { self.delta.as_secs() % seconds_in_minute() } } ``` -------------------------------- ### fmt::Display implementation for PostEpochTime Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Formats the PostEpochTime instance into a human-readable string representation. ```rust impl fmt::Display for PostEpochTime { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}, {} {} {} {:02}:{:02}:{:02}", day_abbrev_string(self.day_of_week()), self.day_of_month(), month_abbrev_string(self.month()), self.year(), self.hour(), self.minute(), self.second()) } } ``` -------------------------------- ### Day and Month enums with string conversions Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Defines the Day and Month enums, with functions day_string, day_abbrev_string, month_string, and month_abbrev_string for full and abbreviated string representations, plus Display implementations. ```rust use std::fmt; use std::time::{Duration, SystemTime, SystemTimeError}; /// Enum with the seven days of the week. #[derive(Debug, Clone, Copy)] pub enum Day { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, } /// Maps the `Day` enum to a string representation, e.g. "Monday". pub fn day_string(day: Day) -> &'static str { match day { Day::Sunday => "Sunday", Day::Monday => "Monday", Day::Tuesday => "Tuesday", Day::Wednesday => "Wednesday", Day::Thursday => "Thursday", Day::Friday => "Friday", Day::Saturday => "Saturday", } } /// Maps the `Day` enum to a shortened string representation, e.g. "Mon". pub fn day_abbrev_string(day: Day) -> &'static str { &day_string(day)[0..3] } impl fmt::Display for Day { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", day_string(*self)) } } /// Enum with the months of the year. #[derive(Debug, Clone, Copy)] pub enum Month { January, February, March, April, May, June, July, August, September, October, November, December, } /// Maps the `Month` enum to a string representation, e.g. "January". pub fn month_string(month: Month) -> &'static str { match month { Month::January => "January", Month::February => "February", Month::March => "March", Month::April => "April", Month::May => "May", Month::June => "June", Month::July => "July", Month::August => "August", Month::September => "September", Month::October => "October", Month::November => "November", Month::December => "December", } } /// Maps the `Month` enum to a shortened string representation, e.g. "Jan". pub fn month_abbrev_string(month: Month) -> &'static str { &month_string(month)[0..3] } impl fmt::Display for Month { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", month_string(*self)) } } ``` -------------------------------- ### days_in_year and days_in_month functions Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Provides functions to calculate the number of days in a given year (handling leap years) and the number of days in a given month, accounting for February in leap years. ```rust /// Takes in a year (e.g. 2019) and returns the number of days in that year. pub fn days_in_year(year: u64) -> u64 { if year % 400 == 0 { 366 } else if year % 100 == 0 { 365 } else if year % 4 == 0 { 366 } else { 365 } } /// Takes in a year and month (e.g. 2020, February) and returns the number of days in that month. pub fn days_in_month(year: u64, month: Month) -> u64 { match month { Month::January => 31, Month::February if days_in_year(year) == 366 => 29, Month::February => 28, Month::March => 31, Month::April => 30, Month::May => 31, Month::June => 30, Month::July => 31, Month::August => 31, Month::September => 30, Month::October => 31, Month::November => 30, Month::December => 31, } } ``` -------------------------------- ### PostEpochTime Source: https://docs.rs/datetimeutils/latest/datetimeutils A thin wrapper for std::time::SystemTime that provides functions to extract year, month, date, etc. Internally stores a Duration since the unix epoch. ```APIDOC ## Struct PostEpochTime ### Description Conceptually a thin wrapper for `std::time::SystemTime`, but provides more useful functions. The impl of this struct has functions that allow easily extracting the year/month/date/etc. for the given point in time. In actual fact the internal representation of this struct is a `Duration` since the unix epoch, so that error-handling is only required once upon creating the instance, and not for each attempt at extracting date/time fields. ### Fields - Internal representation: `Duration` since the unix epoch. ### Methods - Functions to extract year, month, date, etc. (not detailed in source). ``` -------------------------------- ### days_in_month(year: u64, month: Month) -> u64 Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.days_in_month.html Takes in a year and month (e.g. 2020, February) and returns the number of days in that month. ```APIDOC ## Function: days_in_month ### Description Takes in a year and month (e.g. 2020, February) and returns the number of days in that month. ### Signature rust pub fn days_in_month(year: u64, month: Month) -> u64 ### Parameters - **year** (u64) - The year to check. - **month** (Month) - The month to check. ### Returns - **u64** - The number of days in the given month of the given year. ``` -------------------------------- ### Month index conversion functions Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Provides index_from_month to convert a Month enum to an integer 1-12, and month_from_index to convert an integer back to a Month, returning None for out-of-range values. ```rust /// Converts a `Month` enum to an integer in the range 1-12. pub fn index_from_month(month: Month) -> u64 { match month { Month::January => 1, Month::February => 2, Month::March => 3, Month::April => 4, Month::May => 5, Month::June => 6, Month::July => 7, Month::August => 8, Month::September => 9, Month::October => 10, Month::November => 11, Month::December => 12, } } /// Converts an integer in the range 1-12 into the corresponding `Month` enum. /// Values outside the 1-12 range are converted to `None`. pub fn month_from_index(index: u64) -> Option { match index { 1 => Some(Month::January), 2 => Some(Month::February), 3 => Some(Month::March), 4 => Some(Month::April), 5 => Some(Month::May), 6 => Some(Month::June), 7 => Some(Month::July), 8 => Some(Month::August), 9 => Some(Month::September), 10 => Some(Month::October), 11 => Some(Month::November), 12 => Some(Month::December), _ => None, } } ``` -------------------------------- ### Print current UTC time with PostEpochTime::now() Source: https://docs.rs/datetimeutils/latest/src/pretty_now/pretty_now.rs.html Use this snippet to print the current time in the UTC timezone. It calls PostEpochTime::now() and unwraps the result, printing the formatted time. Requires the datetimeutils crate. ```rust use datetimeutils::PostEpochTime; fn main() { println!("It is now {} in the UTC timezone", PostEpochTime::now().unwrap()); } ``` -------------------------------- ### PostEpochTime smoke test Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html A unit test verifying the conversion of a SystemTime to a formatted PostEpochTime string. ```rust #[cfg(test)] mod tests { use super::*; #[test] fn smoke_test() { let timestamp = SystemTime::UNIX_EPOCH + Duration::new(1580610340, 123); let pet = PostEpochTime::from(×tamp).unwrap(); assert_eq!(format!("{}", pet), "Sun, 2 Feb 2020 02:25:40".to_string()); } } ``` -------------------------------- ### day_string Source: https://docs.rs/datetimeutils Maps the Day enum to a string representation, e.g. 'Monday'. ```APIDOC ## day_string ### Description Maps the Day enum to a string representation, e.g. 'Monday'. ### Parameters - day (Day) - The day of the week. ### Returns A string representation of the day. ``` -------------------------------- ### Seconds constants functions Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Provides functions returning the number of seconds in a day, hour, and minute as constants. ```rust /// Returns the number of seconds in a day. pub fn seconds_in_day() -> u64 { 24 * 60 * 60 } /// Returns the number of seconds in an hour. pub fn seconds_in_hour() -> u64 { 60 * 60 } /// Returns the number of seconds in a minute. pub fn seconds_in_minute() -> u64 { 60 } ``` -------------------------------- ### days_in_month Source: https://docs.rs/datetimeutils Takes in a year and month (e.g. 2020, February) and returns the number of days in that month. ```APIDOC ## days_in_month ### Description Takes in a year and month (e.g. 2020, February) and returns the number of days in that month. ### Parameters - year (integer) - The year. - month (Month) - The month. ### Returns The number of days in the given month. ``` -------------------------------- ### day_abbrev_string Source: https://docs.rs/datetimeutils Maps the Day enum to a shortened string representation, e.g. 'Mon'. ```APIDOC ## day_abbrev_string ### Description Maps the Day enum to a shortened string representation, e.g. 'Mon'. ### Parameters - day (Day) - The day of the week. ### Returns A shortened string representation of the day. ``` -------------------------------- ### seconds_in_day() Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.seconds_in_day.html Returns the number of seconds in a day. This function takes no arguments and returns a u64 value. ```APIDOC ## Function seconds_in_day ### Description Returns the number of seconds in a day. ### Signature ```rust pub fn seconds_in_day() -> u64 ``` ### Parameters None ### Return Value - **u64** - The number of seconds in a day. ``` -------------------------------- ### pub fn index_from_month(month: Month) -> u64 Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.index_from_month.html Converts a `Month` enum to its integer representation (1-12). This function is part of the datetimeutils crate. ```APIDOC ## Function: index_from_month ### Description Converts a `Month` enum to an integer in the range 1-12. ### Signature ```rust pub fn index_from_month(month: Month) -> u64 ``` ### Parameters - **month** (`Month`) - The month enum to convert. ### Return Value - **u64** - The integer representation of the month, in the range 1-12. ``` -------------------------------- ### days_in_year Source: https://docs.rs/datetimeutils Takes in a year (e.g. 2019) and returns the number of days in that year. ```APIDOC ## days_in_year ### Description Takes in a year (e.g. 2019) and returns the number of days in that year. ### Parameters - year (integer) - The year. ### Returns The number of days in the given year. ``` -------------------------------- ### PostEpochTime::second_in_day Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the second within the day (0-indexed). ```APIDOC ## PostEpochTime::second_in_day ### Description Returns the second within the day (0-indexed). This will be in the range 0..86399 (inclusive). ### Method `pub fn second_in_day(&self) -> u64` ### Returns - `u64` - The second within the day (0-indexed). ``` -------------------------------- ### seconds_in_minute() Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.seconds_in_minute.html Returns the number of seconds in a minute as a u64. ```APIDOC ## seconds_in_minute() ### Description Returns the number of seconds in a minute. ### Function Signature pub fn seconds_in_minute() -> u64 ### Parameters None ### Return Value - **u64** - The number of seconds in a minute. ### Example ```rust let seconds = datetimeutils::seconds_in_minute(); ``` ``` -------------------------------- ### PostEpochTime::day_of_month Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the day of the month for this point in time (1-indexed). ```APIDOC ## PostEpochTime::day_of_month ### Description Returns the day of the month for this point in time (1-indexed). A return value of 1 means it falls on the first of the month. The maximum returned value will be 31. ### Method `pub fn day_of_month(&self) -> u64` ### Returns - `u64` - The day of the month (1-indexed). ``` -------------------------------- ### pub fn day_abbrev_string(day: Day) -> &'static str Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.day_abbrev_string.html Maps the Day enum to a shortened string representation, e.g., 'Mon'. This function is part of the datetimeutils crate and returns a static string representing the abbreviated day name. ```APIDOC ## Function day_abbrev_string ### Description Maps the `Day` enum to a shortened string representation, e.g. "Mon". ### Signature ```rust pub fn day_abbrev_string(day: Day) -> &'static str ``` ### Parameters - **day** (`Day`) - The day enum value to convert. ### Returns - **&'static str** - The abbreviated string representation of the day. ``` -------------------------------- ### pub fn day_string(day: Day) -> &'static str Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.day_string.html Maps a `Day` enum value to its string representation, e.g., "Monday". This function takes a `Day` enum as input and returns a static string representing the day of the week. ```APIDOC ## Function: day_string ### Description Maps the `Day` enum to a string representation, e.g., "Monday". ### Signature ```rust pub fn day_string(day: Day) -> &'static str ``` ### Parameters - **day** (`Day`) - Required - The day of the week enum value to convert to a string. ### Returns - `&'static str` - The string representation of the day, such as "Monday". ### Example Usage ```rust let day = Day::Monday; let s = day_string(day); assert_eq!(s, "Monday"); ``` ``` -------------------------------- ### PostEpochTime::days_since_epoch Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the number of complete days passed since the Unix epoch. ```APIDOC ## PostEpochTime::days_since_epoch ### Description Returns the number of complete days passed since the unix epoch. ### Method `pub fn days_since_epoch(&self) -> u64` n ### Returns - `u64` - The number of complete days since the Unix epoch. ``` -------------------------------- ### month_abbrev_string(month: Month) -> &'static str Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.month_abbrev_string.html Maps the Month enum to a shortened string representation, e.g. 'Jan'. ```APIDOC ## Function: month_abbrev_string ### Description Maps the `Month` enum to a shortened string representation, e.g. "Jan". ### Signature ```rust pub fn month_abbrev_string(month: Month) -> &'static str ``` ### Parameters - **month** (Month) - Required - The month enum value to convert. ### Return Value - **&'static str** - The shortened string representation of the month. ``` -------------------------------- ### Month Enum Source: https://docs.rs/datetimeutils/latest/datetimeutils Enum with the months of the year. ```APIDOC ## Enum Month ### Description Enum with the months of the year. ``` -------------------------------- ### PostEpochTime::seconds_since_epoch Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the number of complete seconds passed since the Unix epoch. ```APIDOC ## PostEpochTime::seconds_since_epoch ### Description Returns the number of complete seconds passed since the unix epoch. ### Method `pub fn seconds_since_epoch(&self) -> u64` n ### Returns - `u64` - The number of complete seconds since the Unix epoch. ``` -------------------------------- ### PostEpochTime::day_of_year Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the day of the year for this point in time (1-indexed). ```APIDOC ## PostEpochTime::day_of_year ### Description Returns the day of the year for this point in time (1-indexed). A return value of 1 indicates January 1, a value of 2 indicates January 2, and so on. If the year is a leap year the largest returned value would be 366, and for non-leap years it would be 365. ### Method `pub fn day_of_year(&self) -> u64` n ### Returns - `u64` - The day of the year (1-indexed). ``` -------------------------------- ### PostEpochTime::month Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the month this point in time falls on. ```APIDOC ## PostEpochTime::month ### Description Returns the month this point in time falls on. ### Method `pub fn month(&self) -> Month` ### Returns - `Month` - The month (e.g., January, February, etc.). ``` -------------------------------- ### Day enum definition Source: https://docs.rs/datetimeutils/latest/datetimeutils/enum.Day.html Defines the Day enum with variants for each day of the week. ```rust pub enum Day { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, } ``` -------------------------------- ### month_string(month: Month) -> &'static str Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.month_string.html Maps the Month enum to a string representation, e.g. 'January'. ```APIDOC ## Function: month_string ### Description Maps the `Month` enum to a string representation, e.g. "January". ### Signature ```rust pub fn month_string(month: Month) -> &'static str ``` ### Parameters - **month** (Month) - Required - The month enum value to convert to a string. ### Returns - **&'static str** - The string representation of the month (e.g., "January"). ``` -------------------------------- ### PostEpochTime::day_of_week Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the day of the week that this point in time falls on. ```APIDOC ## PostEpochTime::day_of_week ### Description Returns the day of the week that this point in time falls on. ### Method `pub fn day_of_week(&self) -> Day` n ### Returns - `Day` - The day of the week (e.g., Thursday, Friday, etc.). ``` -------------------------------- ### PostEpochTime::milliseconds_since_epoch Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the number of milliseconds passed since the Unix epoch. ```APIDOC ## PostEpochTime::milliseconds_since_epoch ### Description Returns the number of milliseconds passed since the unix epoch. ### Method `pub fn milliseconds_since_epoch(&self) -> u128` ### Returns - `u128` - The number of milliseconds since the Unix epoch. ``` -------------------------------- ### PostEpochTime::nanoseconds_since_epoch Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the number of nanoseconds passed since the Unix epoch. ```APIDOC ## PostEpochTime::nanoseconds_since_epoch ### Description Returns the number of nanoseconds passed since the unix epoch. ### Method `pub fn nanoseconds_since_epoch(&self) -> u128` n ### Returns - `u128` - The number of nanoseconds since the Unix epoch. ``` -------------------------------- ### PostEpochTime::year Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the year (e.g., 2020) this point in time falls on. ```APIDOC ## PostEpochTime::year ### Description Returns the year (e.g., 2020) this point in time falls on. ### Method `pub fn year(&self) -> u64` n ### Returns - `u64` - The year (e.g., 2020). ``` -------------------------------- ### PostEpochTime::second_in_hour Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the second within the hour (0-indexed). ```APIDOC ## PostEpochTime::second_in_hour ### Description Returns the second within the hour (0-indexed). This will be in the range 0..3599 (inclusive). ### Method `pub fn second_in_hour(&self) -> u64` ### Returns - `u64` - The second within the hour (0-indexed). ``` -------------------------------- ### index_from_month Source: https://docs.rs/datetimeutils Converts a Month enum to an integer in the range 1-12. ```APIDOC ## index_from_month ### Description Converts a Month enum to an integer in the range 1-12. ### Parameters - month (Month) - The month. ### Returns An integer in the range 1-12. ``` -------------------------------- ### PostEpochTime::microseconds_since_epoch Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the number of microseconds passed since the Unix epoch. ```APIDOC ## PostEpochTime::microseconds_since_epoch ### Description Returns the number of microseconds passed since the unix epoch. ### Method `pub fn microseconds_since_epoch(&self) -> u128` ### Returns - `u128` - The number of microseconds since the Unix epoch. ``` -------------------------------- ### seconds_in_minute Source: https://docs.rs/datetimeutils Returns the number of seconds in a minute. ```APIDOC ## seconds_in_minute ### Description Returns the number of seconds in a minute. ### Returns The number of seconds in a minute. ``` -------------------------------- ### month_from_index Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.month_from_index.html Converts an integer in the range 1-12 into the corresponding Month enum. Values outside the 1-12 range are converted to None. ```APIDOC ## Function: month_from_index ### Description Converts an integer in the range 1-12 into the corresponding `Month` enum. Values outside the 1-12 range are converted to `None`. ### Signature ```rust pub fn month_from_index(index: u64) -> Option ``` ### Parameters - **index** (u64) - Required - The integer index representing a month (1-12). ### Return Value - **Option** - Returns `Some(Month)` if the index is in the range 1-12, otherwise `None`. ### Example ```rust let month = month_from_index(1); // Some(Month::January) let invalid = month_from_index(13); // None ``` ``` -------------------------------- ### PostEpochTime::hour Source: https://docs.rs/datetimeutils/latest/src/datetimeutils/lib.rs.html Returns the hour within the day (0-indexed). ```APIDOC ## PostEpochTime::hour ### Description Returns the hour within the day (0-indexed). This will be in the range 0..23 (inclusive). ### Method `pub fn hour(&self) -> u64` ### Returns - `u64` - The hour within the day (0-indexed). ``` -------------------------------- ### seconds_in_hour Source: https://docs.rs/datetimeutils/latest/datetimeutils/fn.seconds_in_hour.html Returns the number of seconds in an hour. This function takes no arguments and returns a u64 value. ```APIDOC ## Function seconds_in_hour ### Description Returns the number of seconds in an hour. ### Signature pub fn seconds_in_hour() -> u64 ### Parameters None ### Return Value - **u64** - The number of seconds in an hour. ### Example ```rust let seconds = datetimeutils::seconds_in_hour(); ``` ``` -------------------------------- ### Day Enum Definition Source: https://docs.rs/datetimeutils/latest/datetimeutils/enum.Day.html The Day enum represents the seven days of the week. It is a public enum with variants for each day. ```APIDOC ## Day Enum ### Description The Day enum represents the seven days of the week. ### Definition ```rust pub enum Day { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, } ``` ### Variants - **Sunday** - The first day of the week. - **Monday** - The second day of the week. - **Tuesday** - The third day of the week. - **Wednesday** - The fourth day of the week. - **Thursday** - The fifth day of the week. - **Friday** - The sixth day of the week. - **Saturday** - The seventh day of the week. ### Trait Implementations - **Clone** - Provides clone and clone_from methods. - **Copy** - Marker trait for copy semantics. - **Debug** - Provides formatting for debugging. - **Display** - Provides human-readable formatting. ``` -------------------------------- ### Month Enum Definition Source: https://docs.rs/datetimeutils/latest/datetimeutils/enum.Month.html The Month enum represents the months of the year with twelve variants. It is part of the datetimeutils crate and can be used to represent a month in date-related operations. ```APIDOC ## Month Enum ### Description The Month enum represents the twelve months of the year. It is defined in the datetimeutils crate and provides a type-safe way to work with months. ### Definition ```rust pub enum Month { January, February, March, April, May, June, July, August, September, October, November, December, } ``` ### Variants - **January** - The first month of the year. - **February** - The second month of the year. - **March** - The third month of the year. - **April** - The fourth month of the year. - **May** - The fifth month of the year. - **June** - The sixth month of the year. - **July** - The seventh month of the year. - **August** - The eighth month of the year. - **September** - The ninth month of the year. - **October** - The tenth month of the year. - **November** - The eleventh month of the year. - **December** - The twelfth month of the year. ### Trait Implementations The Month enum implements the following traits: - **Clone** - Allows cloning of Month values. - **Copy** - Allows copying of Month values. - **Debug** - Allows formatting with the Debug formatter. - **Display** - Allows formatting with the Display formatter, enabling conversion to a string representation. ### Usage Example ```rust use datetimeutils::Month; let month = Month::January; println!("{}", month); // Output: January ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.