Skip to content

Commit

Permalink
make serde optional in solana-clock
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Aug 2, 2024
1 parent d82c344 commit 2b8e350
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions sdk/clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
serde = { workspace = true }
serde_derive = { workspace = true }
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-sdk-macro = { workspace = true }

[dev-dependencies]
static_assertions = { workspace = true }

[features]
serde = ["dep:serde", "dep:serde_derive"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
10 changes: 5 additions & 5 deletions sdk/clock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
//!
//! [oracle]: https://docs.solanalabs.com/implemented-proposals/validator-timestamp-oracle
use {
serde_derive::{Deserialize, Serialize},
solana_sdk_macro::CloneZeroed,
};
#[cfg(feature = "serde")]
use serde_derive::{Deserialize, Serialize};
use solana_sdk_macro::CloneZeroed;

/// The default tick rate that the cluster attempts to achieve (160 per second).
///
Expand Down Expand Up @@ -175,7 +174,8 @@ pub type UnixTimestamp = i64;
///
/// All members of `Clock` start from 0 upon network boot.
#[repr(C)]
#[derive(Serialize, Deserialize, Debug, CloneZeroed, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, CloneZeroed, Default, PartialEq, Eq)]
pub struct Clock {
/// The current `Slot`.
pub slot: Slot,
Expand Down
2 changes: 1 addition & 1 deletion sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ serde_derive = { workspace = true }
sha2 = { workspace = true }
sha3 = { workspace = true }
solana-atomic-u64 = { workspace = true }
solana-clock = { workspace = true }
solana-clock = { workspace = true, features = ["serde"] }
solana-decode-error = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
Expand Down

0 comments on commit 2b8e350

Please sign in to comment.