Skip to main content

gnss_time/
lib.rs

1//! # gnss-time
2//!
3//! A type-safe GNSS time scale library with zero runtime overhead.
4//!
5//! Supports conversions between:
6//! - GPS
7//! - UTC
8//! - GLONASS
9//! - Galileo
10//! - BeiDou
11//! - TAI
12//!
13//! Leap seconds are handled explicitly via a provider trait, ensuring
14//! deterministic behavior and full `no_std` compatibility.
15//!
16//! ## Design goals
17//!
18//! - Zero allocations
19//! - No global mutable state
20//! - Fully deterministic conversions
21//! - Embedded-friendly (`no_std`)
22//! - Strong type safety across time scales
23//!
24//! ## Quick start
25//!
26//! ```rust
27//! use gnss_time::prelude::*;
28//!
29//! let gps = Time::<Gps>::from_week_tow(
30//!     2345,
31//!     DurationParts {
32//!         seconds: 432_000,
33//!         nanos: 0,
34//!     },
35//! )
36//! .unwrap();
37//!
38//! assert_eq!(gps.to_string(), "GPS 2345:432000.000");
39//!
40//! let utc: Time<Utc> = gps.into_scale_with(LeapSeconds::builtin()).unwrap();
41//! ```
42
43#![no_std]
44#![forbid(unsafe_code)]
45#![deny(missing_docs)]
46#![warn(clippy::must_use_candidate)]
47
48#[cfg(any(feature = "std", test))]
49extern crate std;
50
51// Core modules
52pub mod convert;
53pub mod duration;
54pub mod epoch;
55pub mod error;
56pub mod leap;
57pub mod matrix;
58pub mod scale;
59pub mod time;
60
61// Internal implementation details (not public API)
62mod tables;
63
64// Re-exports (public API surface)
65pub use convert::*;
66pub use duration::*;
67pub use epoch::*;
68pub use error::*;
69pub use leap::*;
70pub use matrix::*;
71pub use scale::*;
72pub use time::*;
73
74/// Common imports for typical usage.
75///
76/// # Example
77///
78/// ```rust
79/// use gnss_time::prelude::*;
80/// ```
81pub mod prelude;