gw2timers

Crates.iogw2timers
lib.rsgw2timers
version0.4.1
sourcesrc
created_at2021-06-18 15:36:35.421297
updated_at2022-03-28 20:32:34.57137
descriptionIterate and collect Guild Wars 2 map meta event times
homepagehttps://github.com/purplg/gw2timers
repositoryhttps://github.com/purplg/gw2timers
max_upload_size
id411802
size59,480
Ben Whitley (purplg)

documentation

README

GW2timers

A simple way to iterate and collect Guild Wars 2 map meta event times

Example

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>>();
}

Usage

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.

Create an iterator starting at a time

let mut tangled_depths_5am_utc =
    MapMetaKind::TangledDepths
        .into_iter()
        .time(NaiveTime::from_hms(5, 0, 0));

Skip forward through time

let mut tangled_depths_6am_utc =
    tangled_depths_5am_utc
    .fast_forward(Duration::hours(1));

Get the event active at that time in the iterator

let tangled_depths_event_at_6am_utc: Option<EventInstance> =
    tangled_depths_6am_utc
    .now();

License

MIT

Commit count: 52

cargo fmt