from_bytes

Function from_bytes 

Source
pub fn from_bytes<T>(bytes: &[u8]) -> Result<T, ToFromByteError>
where T: for<'a> ToFromBytes<'a>,
Expand description

Convenience function.

Deserializes a complete value from a byte slice.

Fails with TrailingBytes if the input contains extra data after the value. This is intentional, silently ignoring trailing bytes is a common source of errors and security bugs.

Use this when you expect exactly one message per buffer (most common case).