sunrise-lite
This crate provides a function for calculating sunrise and sunset times using this method.
Forked from https://github.com/nathan-osman/rust-sunrise.
Usage
In order to perform the calculation, you'll need to provide the following:
- the date for which you wish to calculate the times
- the latitude and longitude of the location
Begin by adding this crate to Cargo.toml
:
[]
= "1.0.0"
Next, add a declaration for the crate:
use sunrise_lite;
You can use
the sunrise_sunset
function to perform the calculation:
// Calculate times for January 1, 2016 in Toronto
let = sunrise_sunset;