diff --git a/src/lib.rs b/src/lib.rs index 48cce45..aa7495e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ pub use error::{Error, Result}; // pub use de::take_from_bytes; // kudos to postcard, this is much nicer than returning size -pub fn cbor_serialize<'a, T: serde::Serialize>( +pub fn cbor_serialize<'a, T: ?Sized + serde::Serialize>( object: &T, buffer: &'a mut [u8], ) -> Result<&'a [u8]> { @@ -33,7 +33,7 @@ pub fn cbor_serialize<'a, T: serde::Serialize>( } /// Append serialization of object to existing bytes, returning length of serialized object. -pub fn cbor_serialize_extending_bytes( +pub fn cbor_serialize_extending_bytes( object: &T, bytes: &mut Bytes, ) -> Result { @@ -46,7 +46,9 @@ pub fn cbor_serialize_extending_bytes( } /// Serialize object into newly allocated Bytes. -pub fn cbor_serialize_bytes(object: &T) -> Result> { +pub fn cbor_serialize_bytes( + object: &T, +) -> Result> { let mut data = Bytes::::new(); cbor_serialize_extending_bytes(object, &mut data)?; Ok(data)