Struct bencode_decoder::BString
[−]
[src]
pub struct BString {
// some fields omitted
}Struct for representing string (byte sequence) in Bencode format.
Methods
impl BString[src]
Trait Implementations
impl PartialEq for BString[src]
Basic equivalence relation.
Checks for equality simply using BString's data field. Works exactly
like equivalence in &[u8].
fn eq(&self, other: &Self) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Self) -> bool
This method tests for !=.
impl Eq for BString[src]
Guarantees to be reflexive.
impl Debug for BString[src]
Simple Debug implementation.
Works just like [u8]::fmt.
impl BElement<BString> for BString[src]
fn decode(encoded: &[u8]) -> Result<(usize, BString), &'static str>
Decodes BString from array of bytes.
Returns Ok((position of last used byte in passed array, parsed BString))
or Err if couldn't parse BString correctly.
Examples
BString must have following structure:
use bencode::BElement; use bencode::BString; assert_eq!((4, BString::new("abc".as_bytes())), BString::decode("3:abc".as_bytes()).ok().expect("invalid"));