Skip to content

Commit

Permalink
Improve backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Oct 9, 2024
1 parent c1aa131 commit 713928f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ serde = { version = "1", default-features = false, features = ["derive"] }
serde_bytes = "0.11.12"

[features]
default = ["heapless-bytes-v0-3"]
heapless-bytes-v0-3 = ["dep:heapless-bytes-v0-3", "heapless-v0-7"]
heapless-bytes-v0-4 = ["dep:heapless-bytes-v0-4"]
heapless-v0-7 = ["dep:heapless-v0-7"]
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub fn cbor_serialize<'a, T: ?Sized + serde::Serialize>(
}

#[cfg(feature = "heapless-bytes-v0-3")]
#[deprecated(note = "use `cbor_serialize_to` instead")]
/// Append serialization of object to existing bytes, returning length of serialized object.
pub fn cbor_serialize_extending_bytes<T: ?Sized + serde::Serialize, const N: usize>(
object: &T,
Expand All @@ -55,6 +56,7 @@ pub fn cbor_serialize_bytes<T: ?Sized + serde::Serialize, const N: usize>(
object: &T,
) -> Result<heapless_bytes_v0_3::Bytes<N>> {
let mut data = heapless_bytes_v0_3::Bytes::<N>::new();
#[allow(deprecated)]
cbor_serialize_extending_bytes(object, &mut data)?;
Ok(data)
}
Expand Down

0 comments on commit 713928f

Please sign in to comment.