[][src]Function esbat::daily_lunar_phase_iter

pub fn daily_lunar_phase_iter<B>(range: B) -> DailyIter where
    B: RangeBounds<Date<Utc>>, 

Returns an iterator of principal phases and the days they fall on.

use chrono::{TimeZone, Utc};
use esbat::PrincipalPhase;

let start = Utc.ymd(2020, 10, 1);
let end = Utc.ymd(2020, 11, 1);
let mut iter = esbat::daily_lunar_phase_iter(start..end);

assert_eq!(iter.next().unwrap(), (PrincipalPhase::FullMoon, Utc.ymd(2020, 10, 1)));
assert_eq!(iter.next().unwrap(), (PrincipalPhase::LastQuarter, Utc.ymd(2020, 10, 10)));
assert_eq!(iter.next().unwrap(), (PrincipalPhase::NewMoon, Utc.ymd(2020, 10, 16)));
assert_eq!(iter.next().unwrap(), (PrincipalPhase::FirstQuarter, Utc.ymd(2020, 10, 23)));
assert_eq!(iter.next().unwrap(), (PrincipalPhase::FullMoon, Utc.ymd(2020, 10, 31)));
assert!(iter.next().is_none());