From 62c05473f76ead781aaa9d4a3e4057b86e543747 Mon Sep 17 00:00:00 2001 From: gutzchi <71404713+gutzchi@users.noreply.github.com> Date: Thu, 23 Mar 2023 23:13:43 +0100 Subject: [PATCH] improved documentation of the cobs decoding (#97) --- src/de/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/mod.rs b/src/de/mod.rs index 67c45fc..c17751b 100644 --- a/src/de/mod.rs +++ b/src/de/mod.rs @@ -20,6 +20,8 @@ where /// Deserialize a message of type `T` from a cobs-encoded byte slice. The /// unused portion (if any) of the byte slice is not returned. +/// The used portion of the input slice is modified during deserialization (even if an error is returned). +/// Therefore, if this is not desired, pass a clone of the original slice. pub fn from_bytes_cobs<'a, T>(s: &'a mut [u8]) -> Result where T: Deserialize<'a>, @@ -29,7 +31,9 @@ where } /// Deserialize a message of type `T` from a cobs-encoded byte slice. The -/// unused portion (if any) of the byte slice is returned for further usage +/// unused portion (if any) of the byte slice is returned for further usage. +/// The used portion of the input slice is modified during deserialization (even if an error is returned). +/// Therefore, if this is not desired, pass a clone of the original slice. pub fn take_from_bytes_cobs<'a, T>(s: &'a mut [u8]) -> Result<(T, &'a mut [u8])> where T: Deserialize<'a>,