Skip to main content

from_bytes_lenient

Function from_bytes_lenient 

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

Deserialize a value from bencode bytes, accepting unsorted dictionary keys.

Many real-world BitTorrent clients send extension handshakes and other messages with unsorted dictionary keys. This function accepts such input while still correctly parsing all bencode types.

ยงErrors

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