Skip to main content

from_bytes

Function from_bytes 

Source
pub fn from_bytes<'de, T: Deserialize<'de>>(bytes: &'de [u8]) -> Result<T>
Expand description

Deserialize a value from bencode bytes.

Enforces BEP 3 dictionary key ordering. Use from_bytes_lenient for peer wire messages where real-world clients may send unsorted keys.

ยงErrors

Returns an error if the bytes are not valid bencode or cannot be deserialized into T.