The release 0.3.0 of the crate spa is fixing the flaw of the API, and updating to Rust edition 2021.
The SPA can be used to calculate solar position (azimuth and zenith_angle) and the time of sunrise and sunset. This data can be used to optimize the position of solar panels, to optimize load-cycles of energy storages, or to increase or reduce the lighting at home or in vehicles.
As for the flaw in the API: Just implementing unittests, I wasn’t aware that the members of the structure SolarPos lacked the declaration pub. Users of the lib were not able to read the result from return value! Now, after adding example files, these examples are verifying those members are publicly accessible, see below.
// ... pub enum SunriseAndSet { PolarNight, PolarDay, Daylight(DateTime<Utc>, DateTime<Utc>), } // ... pub struct SolarPos { // horizontal angle measured clockwise ... pub azimuth: f64, // the angle between the zenith and the center of the sun's disc pub zenith_angle: f64, }
Moreover the bench tests caused additional complexity due to the required feature handling and conditional builds. For that reason the bench tests have been removed.
In the moment the bench API is getting stabilized any time in future, these bench test will be put back.
Lessons learned: Avoid superfluous complexity and ship with examples always!