From c749b095ee4676cf4fa351cef992d96240cb914f Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 23 Jan 2023 13:54:50 +0100 Subject: [PATCH] Remove public postcard re-exports postcard serialization is only used internally and therefore is an implementation detail that should not be part of the public API. Crates that also need postcard serialization should declare their own dependency for that. --- CHANGELOG.md | 2 ++ src/lib.rs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2454a18850..724978871f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated `littlefs2` to 0.4.0. - Made `Request`, `Reply`, `Error`, `Context`, `CoreContext`, `Mechanism`, `ui::Status` non-exhaustive. +- Made `postcard_deserialize`, `postcard_serialize` and + `postcard_serialize_bytes` private. ### Fixed diff --git a/src/lib.rs b/src/lib.rs index b45fc39a8f4..177dd376c01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,11 +48,12 @@ pub use error::Error; pub use platform::Platform; pub use service::Service; -pub use cbor_smol::{cbor_deserialize, cbor_serialize, cbor_serialize_bytes}; +pub use cbor_smol::{cbor_deserialize, cbor_serialize_bytes}; pub use heapless_bytes::Bytes; -pub use postcard::{from_bytes as postcard_deserialize, to_slice as postcard_serialize}; -pub fn postcard_serialize_bytes( +pub(crate) use postcard::from_bytes as postcard_deserialize; + +pub(crate) fn postcard_serialize_bytes( object: &T, ) -> postcard::Result> { let vec = postcard::to_vec(object)?;