pub enum Period {
Days(i64),
Weeks(i64),
Months(i64),
Years(i64),
}Expand description
Typed period for historical queries.
Prefer this over raw strings when you want compile-time discoverability.
§Example
use dukascopy_fx::{Period, Ticker};
let ticker = Ticker::try_new("EUR", "USD")?;
let rows = ticker.history_period(Period::Weeks(2)).await?;
println!("rows={}", rows.len());Variants§
Days(i64)
N calendar days.
Weeks(i64)
N weeks (7-day buckets).
Months(i64)
N months as 30-day blocks.
Years(i64)
N years as 365-day blocks.
Implementations§
Source§impl Period
impl Period
Sourcepub fn to_duration(self) -> Result<Duration, DukascopyError>
pub fn to_duration(self) -> Result<Duration, DukascopyError>
Converts typed period into internal chrono::Duration.
Returns validation error for non-positive values.
Trait Implementations§
impl Copy for Period
impl Eq for Period
impl StructuralPartialEq for Period
Auto Trait Implementations§
impl Freeze for Period
impl RefUnwindSafe for Period
impl Send for Period
impl Sync for Period
impl Unpin for Period
impl UnsafeUnpin for Period
impl UnwindSafe for Period
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.