harbor run -t openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-1361harbor download openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-1361Task Description: Implement the OffsetDateTime Struct and Its Associated Methods
You need to implement the OffsetDateTime struct along with its associated methods to make all provided Rust tests pass. The core functionality must adhere to the following specific requirements:
Current Time Methods:
OffsetDateTime::now_utc() to return the current UTC time.OffsetDateTime::now_local() to return the current local time.OffsetDateTime::try_now_local() that returns a Result indicating success or failure when attempting to get the local time.Time Conversion:
to_offset(self, offset: UtcOffset) that converts the OffsetDateTime instance to the specified offset, adjusting the hours and ensuring the date remains consistent.Unix Epoch and Timestamps:
OffsetDateTime::unix_epoch() to return the date and time representing the Unix epoch (1970-01-01 00:00:00 UTC).OffsetDateTime::from_unix_timestamp(seconds: i64) to create an OffsetDateTime from a given Unix timestamp (in seconds).OffsetDateTime::from_unix_timestamp_nanos(nanos: i64) for similarly creating an instance from a Unix timestamp in nanoseconds.Date and Time Accessors:
year()month()day()hour()minute()second()millisecond()microsecond()nanosecond()date() and time() methods that return the date and time components, respectively.month_day() and ordinal() to return the month/day and the ordinal day of the year.ISO Week and Weekday:
iso_year_week() and week() methods to calculate the ISO year and week number.weekday() method to return the corresponding day of the week (Monday through Sunday).Arithmetic Operations:
OffsetDateTime.Formatting and Parsing:
format(template: &str) method which formats the OffsetDateTime to a string based on the specified template.parse(input: &str, format: &str) to create an OffsetDateTime instance from a formatted string.Comparison and Hashing:
PartialEq, PartialOrd, Ord, Hash) for equality and ordering comparisons between OffsetDateTime instances.Testing for Standard Library:
SystemTime interactions.Place the full implementation in the /app/ directory, ensuring it adheres to Rust's best practices. Make all tests pass to demonstrate the functionality is correctly implemented.