pub enum DatePeriod {
Year,
Quarter,
Month,
Daily,
}
Variants§
Implementations§
Source§impl DatePeriod
impl DatePeriod
Sourcepub fn new(range_type: &str) -> Result<Self>
pub fn new(range_type: &str) -> Result<Self>
Create a new DatePeriod from a string representation.
- Accepts “YEAR”, “Y”, “QUARTER”, “Q”, “MONTH”, “M”, “DAILY”, “D” (case insensitive).
- Returns an error for invalid inputs.
§Examples
use range_date::range_type::DatePeriod;
let dp = DatePeriod::new("Y").unwrap();
assert_eq!(dp, DatePeriod::Year);
let dp = DatePeriod::new("MONTH").unwrap();
assert_eq!(dp, DatePeriod::Month);
let dp = DatePeriod::new("invalid");
assert!(dp.is_err());
pub fn short_name(&self) -> &str
Trait Implementations§
Source§impl Clone for DatePeriod
impl Clone for DatePeriod
Source§fn clone(&self) -> DatePeriod
fn clone(&self) -> DatePeriod
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 DatePeriod
impl Debug for DatePeriod
Source§impl<'de> Deserialize<'de> for DatePeriod
impl<'de> Deserialize<'de> for DatePeriod
Source§fn deserialize<D>(deserializer: D) -> Result<DatePeriod, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<DatePeriod, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DatePeriod
impl Display for DatePeriod
Source§impl FromStr for DatePeriod
impl FromStr for DatePeriod
Source§impl Hash for DatePeriod
impl Hash for DatePeriod
Source§impl Ord for DatePeriod
impl Ord for DatePeriod
Source§fn cmp(&self, other: &DatePeriod) -> Ordering
fn cmp(&self, other: &DatePeriod) -> 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 DatePeriod
impl PartialEq for DatePeriod
Source§impl PartialOrd for DatePeriod
impl PartialOrd for DatePeriod
Source§impl Serialize for DatePeriod
impl Serialize for DatePeriod
impl Eq for DatePeriod
impl StructuralPartialEq for DatePeriod
Auto Trait Implementations§
impl Freeze for DatePeriod
impl RefUnwindSafe for DatePeriod
impl Send for DatePeriod
impl Sync for DatePeriod
impl Unpin for DatePeriod
impl UnwindSafe for DatePeriod
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