From 6ef370611e9e314d922c572f41eaa03ee0658d58 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 18 Oct 2024 12:23:47 +0200 Subject: [PATCH] Release v0.5.0 --- CHANGELOG.md | 14 +++++++++++++- Cargo.toml | 1 - src/lib.rs | 27 --------------------------- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3e68d..36933ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased][] -[Unreleased]: https://github.com/trussed-dev/cbor-smol/compare/0.4.1...HEAD +[Unreleased]: https://github.com/trussed-dev/cbor-smol/compare/0.5.0...HEAD + +- + +## [0.5.0][] - 2024-10-21 + +[0.5.0]: https://github.com/trussed-dev/cbor-smol/compare/0.4.1...0.5.0 + +### Changed - Mark `Error` as non-exhaustive ([#11](https://github.com/trussed-dev/cbor-smol/issues/11)) +- Add support for multiple `heapless` and `heapless-bytes` versions ([#13](https://github.com/trussed-dev/cbor-smol/pull/13)): + - Move existing support for `heapless` 0.7 and `heapless-bytes` 0.3 behind features + - Add support for `heapless` 0.8 and `heapless-bytes` 0.4 + - Remove `cbor_serialize_bytes` and `cbor_serialize_extending_bytes` (use `cbor_serialize_to` instead) ## [0.4.1][] - 2024-10-08 diff --git a/Cargo.toml b/Cargo.toml index 61124ea..80372de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ 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"] diff --git a/src/lib.rs b/src/lib.rs index 0f2cd1f..0dac336 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,33 +34,6 @@ pub fn cbor_serialize<'a, T: ?Sized + serde::Serialize>( Ok(&buffer[..written]) } -#[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( - object: &T, - bytes: &mut heapless_bytes_v0_3::Bytes, -) -> Result { - let len_before = bytes.len(); - let vec: &mut heapless_v0_7::Vec = bytes; - let mut ser = ser::Serializer::new(vec); - - object.serialize(&mut ser)?; - - Ok(ser.into_inner().len() - len_before) -} - -#[cfg(feature = "heapless-bytes-v0-3")] -/// Serialize object into newly allocated Bytes. -pub fn cbor_serialize_bytes( - object: &T, -) -> Result> { - let mut data = heapless_bytes_v0_3::Bytes::::new(); - #[allow(deprecated)] - cbor_serialize_extending_bytes(object, &mut data)?; - Ok(data) -} - pub fn cbor_deserialize<'de, T: serde::Deserialize<'de>>(buffer: &'de [u8]) -> Result { // cortex_m_semihosting::hprintln!("deserializing {:?}", buffer).ok(); de::from_bytes(buffer)