Crates.io | gw2timers |
lib.rs | gw2timers |
version | 0.4.1 |
source | src |
created_at | 2021-06-18 15:36:35.421297 |
updated_at | 2022-03-28 20:32:34.57137 |
description | Iterate and collect Guild Wars 2 map meta event times |
homepage | https://github.com/purplg/gw2timers |
repository | https://github.com/purplg/gw2timers |
max_upload_size | |
id | 411802 |
size | 59,480 |
A simple way to iterate and collect Guild Wars 2 map meta event times
Getting the next 5 upcoming events in Auric Basin
fn main() {
let next_5_auricbasin_events =
MapMetaKind::AuricBasin
.into_iter()
.take(5)
.collect::<Vec<EventInstance>>();
}
Create an iterator by calling into_iter()
on a MapMetaKind
and then you can set time you want to start the iterating at then use it like any other iterator. The iterator will never return None
and will iterate forever always returning the next event in time.
let mut tangled_depths_5am_utc =
MapMetaKind::TangledDepths
.into_iter()
.time(NaiveTime::from_hms(5, 0, 0));
let mut tangled_depths_6am_utc =
tangled_depths_5am_utc
.fast_forward(Duration::hours(1));
let tangled_depths_event_at_6am_utc: Option<EventInstance> =
tangled_depths_6am_utc
.now();
MIT