Skip to content

Commit

Permalink
fix: introduce codec feature flag
Browse files Browse the repository at this point in the history
Implementing the `Codec` trait needs at least Rust version 1.75. This commit
introduces a feature flag, so that lower versions of Rust can be supported,
in case the `Codec` trait implementation is not needed.
  • Loading branch information
vmx committed Mar 25, 2024
1 parent c61ec52 commit 5234df0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ serde_bytes = { version = "0.11.9", default-features = false, features = ["alloc
serde-transcode = "1.1.1"

[features]
default = ["std"]
default = ["codec", "std"]
std = ["cbor4ii/use_std", "ipld-core/std", "serde/std", "serde_bytes/std"]
codec = ["ipld-core/codec"]
# Prevent deserializing CIDs as bytes as much as possible.
no-cid-as-bytes = []
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ extern crate alloc;
mod cbor4ii_nonpub;
// The `Codec` implementation is only available if the `no-cid-as-bytes` feature is disabled, due
// to the links being extracted with a Serde based approach.
#[cfg(all(feature = "std", not(feature = "no-cid-as-bytes")))]
#[cfg(all(feature = "std", not(feature = "no-cid-as-bytes"), feature = "codec"))]
pub mod codec;
pub mod de;
pub mod error;
Expand Down

0 comments on commit 5234df0

Please sign in to comment.