Struct rdest::BDecoder[][src]

pub struct BDecoder {}

Bencode decoder used by metafile/torrent files and BitTorrent protocol.

Implementations

impl BDecoder[src]

pub fn from_array(arg: &[u8]) -> Result<Vec<BValue>, Error>[src]

Decode bencoded values.

Example

use rdest::{BDecoder, BValue};
let val = BDecoder::from_array("i44e".as_bytes()).unwrap();

assert_eq!(val, vec![BValue::Int(44)]);

pub fn values_vector(
    it: &mut Enumerate<Iter<'_, u8>>,
    with_end: bool
) -> Result<Vec<BValue>, Error>
[src]

Build vector with BValue’s

pub fn parse_byte_str(
    it: &mut Enumerate<Iter<'_, u8>>,
    pos: usize,
    first_num: &u8
) -> Result<(Vec<u8>, Vec<u8>), Error>
[src]

Parse bncoded string. It assume that first digit was already consumed, so must be explicitly provided as an argument.

pub fn parse_int(
    it: &mut Enumerate<Iter<'_, u8>>,
    pos: usize
) -> Result<(i64, Vec<u8>), Error>
[src]

Parse bencoded integer till delimiter “e”.

Trait Implementations

impl Clone for BDecoder[src]

impl Debug for BDecoder[src]

impl PartialEq<BDecoder> for BDecoder[src]

impl StructuralPartialEq for BDecoder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.