lightning-distance 0.2.0

Estimate how far away lightning is from the flash-to-thunder delay, plus the 30-second safety rule.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented1 out of 4 items with examples
  • Size
  • Source code size: 4.42 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 135.41 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • theluckystrike

lightning-distance

Estimate how far away lightning is from the flash-to-thunder delay, plus the standard 30-second safety rule. Pure Rust, no deps.

Sound takes roughly 5 seconds to travel one mile (3 seconds per kilometer), so divide the count by 5 for miles or 3 for kilometers. If the gap is 30 seconds or less, the storm is close enough to be dangerous — go inside and wait 30 minutes after the last thunder.

use lightning_distance::{miles, is_dangerous};
let dist = miles(10.0);          // ~2 miles
let danger = is_dangerous(10.0); // true (<=30s)

License: MIT