Skip to content

Commit

Permalink
improved documentation of the cobs decoding (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
gutzchi committed Mar 23, 2023
1 parent a1c3af4 commit 62c0547
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/de/mod.rs
Expand Up @@ -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<T>
where
T: Deserialize<'a>,
Expand All @@ -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>,
Expand Down

0 comments on commit 62c0547

Please sign in to comment.