Skip to content

Commit

Permalink
Merge pull request #20 from us-irs/add-defmt-support
Browse files Browse the repository at this point in the history
Add optional defmt support
  • Loading branch information
sbarral authored Jun 4, 2024
2 parents 3d64811 + c4d25bb commit a929827
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ keywords = ["date", "time", "monotonic", "tai", "gps"]
chrono = { version = "0.4.31", default-features = false, optional = true }
serde = { version = "1", default-features = false, features = ["derive"], optional = true }
nix = { version = "0.26", default-features = false, features = ["time"], optional = true }
defmt = { version = "0.3", optional = true }

[features]
default = ["std"]
Expand All @@ -30,6 +31,7 @@ std = []
# activated since cargo resolver v2 ignores MSRV.
chrono = ["dep:chrono"]
serde = ["dep:serde"]
defmt = ["dep:defmt"]
tai_clock = ["dep:nix"]

[package.metadata.docs.rs]
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
//! `TaiTime` and related error types can be (de)serialized with `serde` by
//! activating the `serde` feature.
//!
//! ### `defmt` support
//!
//! Activating the `defmt` feature will add the
//! [`defmt::Format`](https://defmt.ferrous-systems.com/format) derive on all important structures
//! by this crate.
//!
//! # Examples
//!
Expand Down Expand Up @@ -332,6 +337,7 @@ pub type Tai1972Time = TaiTime<63_072_000>;
/// ```
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct TaiTime<const EPOCH_REF: i64> {
/// The number of whole seconds in the future (if positive) or in the past
/// (if negative) of 1970-01-01 00:00:00 TAI.
Expand Down

0 comments on commit a929827

Please sign in to comment.