pub enum AggregateDate {
Year(u16),
YearAndMonth(u16, u8),
}Expand description
A date range for an AggregatedOutput.
Represents either a year or a year and month.
Variants§
Implementations§
Source§impl AggregateDate
impl AggregateDate
Sourcepub fn as_arbitrary_date(&self) -> Result<Date, Error>
pub fn as_arbitrary_date(&self) -> Result<Date, Error>
Converts the AggregateDate to an arbitrary jiff [Date].
- A
Yearwill be converted to aDateon the first day of the first month of that year. - A
YearAndMonthwill be converted to aDateon the first day of that month of that year.
§Errors
Will return an error if the AggregateDate is not a valid, jiff-expressible year or year and month.
For example, Year(10_000) will return an error, as years in jiff must be below 9999.
§Example
use pvoutput_client::types::response::AggregateDate;
use jiff::civil::Date;
assert_eq!(AggregateDate::Year(2025).as_arbitrary_date()?, Date::constant(2025, 1, 1));
assert_eq!(AggregateDate::YearAndMonth(2025, 9).as_arbitrary_date()?, Date::constant(2025, 9, 1));Sourcepub const fn year(&self) -> u16
pub const fn year(&self) -> u16
Returns this AggregateDate’s year.
§Example
use pvoutput_client::types::response::AggregateDate;
assert_eq!(AggregateDate::Year(2025).year(), 2025);
assert_eq!(AggregateDate::YearAndMonth(2025, 9).year(), 2025);Trait Implementations§
Source§impl Clone for AggregateDate
impl Clone for AggregateDate
Source§fn clone(&self) -> AggregateDate
fn clone(&self) -> AggregateDate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AggregateDate
impl Debug for AggregateDate
Source§impl<'de> Deserialize<'de> for AggregateDate
impl<'de> Deserialize<'de> for AggregateDate
Source§fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for AggregateDate
impl Hash for AggregateDate
Source§impl Ord for AggregateDate
impl Ord for AggregateDate
Source§fn cmp(&self, other: &AggregateDate) -> Ordering
fn cmp(&self, other: &AggregateDate) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for AggregateDate
impl PartialEq for AggregateDate
Source§impl PartialOrd for AggregateDate
impl PartialOrd for AggregateDate
impl Copy for AggregateDate
impl Eq for AggregateDate
impl StructuralPartialEq for AggregateDate
Auto Trait Implementations§
impl Freeze for AggregateDate
impl RefUnwindSafe for AggregateDate
impl Send for AggregateDate
impl Sync for AggregateDate
impl Unpin for AggregateDate
impl UnwindSafe for AggregateDate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more