Struct rdest::BDecoder [−][src]
pub struct BDecoder {}
Bencode decoder used by metafile/torrent files and BitTorrent protocol.
Implementations
impl BDecoder
[src]
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]
it: &mut Enumerate<Iter<'_, u8>>,
with_end: bool
) -> Result<Vec<BValue>, Error>
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]
it: &mut Enumerate<Iter<'_, u8>>,
pos: usize,
first_num: &u8
) -> Result<(Vec<u8>, Vec<u8>), Error>
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]
it: &mut Enumerate<Iter<'_, u8>>,
pos: usize
) -> Result<(i64, Vec<u8>), Error>
Parse bencoded integer till delimiter “e”.
Trait Implementations
impl StructuralPartialEq for BDecoder
[src]
impl StructuralPartialEq for BDecoder
[src]Auto Trait Implementations
impl RefUnwindSafe for BDecoder
impl RefUnwindSafe for BDecoder
impl UnwindSafe for BDecoder
impl UnwindSafe for BDecoder
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]