pub struct Dict<'a, 'p> { /* private fields */ }Expand description
A bencode dictionary
Implementations§
Source§impl<'a, 'p> Dict<'a, 'p>
impl<'a, 'p> Dict<'a, 'p>
Sourcepub fn as_raw_bytes(&self) -> &'a [u8] ⓘ
pub fn as_raw_bytes(&self) -> &'a [u8] ⓘ
Returns raw bytes of this dictionary.
§Examples
Basic usage:
use ben::{Parser, Decoder};
let bytes = b"d1:a1:be";
let parser = &mut Parser::new();
let dict = parser.parse::<Decoder>(bytes).unwrap().into_dict().unwrap();
assert_eq!(b"d1:a1:be", dict.as_raw_bytes());Sourcepub fn get_bytes(&self, key: &str) -> Option<&'a [u8]>
pub fn get_bytes(&self, key: &str) -> Option<&'a [u8]>
Returns the byte slice for the given key.
Sourcepub fn get_str(&self, key: &str) -> Option<&'a str>
pub fn get_str(&self, key: &str) -> Option<&'a str>
Returns the string slice for the given key.
Sourcepub fn get_ascii_str(&self, key: &str) -> Option<&'a str>
pub fn get_ascii_str(&self, key: &str) -> Option<&'a str>
Returns the printable ASCII string slice for the given key.
Trait Implementations§
Source§impl<'a, 'p> IntoIterator for Dict<'a, 'p>
impl<'a, 'p> IntoIterator for Dict<'a, 'p>
Auto Trait Implementations§
impl<'a, 'p> Freeze for Dict<'a, 'p>
impl<'a, 'p> RefUnwindSafe for Dict<'a, 'p>
impl<'a, 'p> Send for Dict<'a, 'p>
impl<'a, 'p> Sync for Dict<'a, 'p>
impl<'a, 'p> Unpin for Dict<'a, 'p>
impl<'a, 'p> UnsafeUnpin for Dict<'a, 'p>
impl<'a, 'p> UnwindSafe for Dict<'a, 'p>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more