pub struct BencodeAny<'a, 't> { /* private fields */ }
Expand description
A bencoded object which could be of any type. You probably want to call
one of as_list()
, as_dict()
, as_int()
, as_string()
to convert this
struct into a concrete type.
Implementations§
Source§impl<'a, 't> BencodeAny<'a, 't>
impl<'a, 't> BencodeAny<'a, 't>
Sourcepub fn as_list(&self) -> Option<BencodeList<'a, 't>>
pub fn as_list(&self) -> Option<BencodeList<'a, 't>>
Try to convert this struct into a BencodeList
. This fails if and
only if the underlying bencoded object is not a list.
Sourcepub fn as_dict(&self) -> Option<BencodeDict<'a, 't>>
pub fn as_dict(&self) -> Option<BencodeDict<'a, 't>>
Try to convert this struct into a BencodeDict
. This fails if and
only if the underlying bencoded object is not a dictionary.
Sourcepub fn as_int(&self) -> Option<BencodeInt<'a, 't>>
pub fn as_int(&self) -> Option<BencodeInt<'a, 't>>
Try to convert this struct into a BencodeInt
. This fails if and
only if the underlying bencoded object is not an integer.
Sourcepub fn as_string(&self) -> Option<BencodeString<'a, 't>>
pub fn as_string(&self) -> Option<BencodeString<'a, 't>>
Try to convert this struct into a BencodeString
. This fails if and
only if the underlying bencoded object is not a string.
Trait Implementations§
Source§impl<'a, 't> Clone for BencodeAny<'a, 't>
impl<'a, 't> Clone for BencodeAny<'a, 't>
Source§fn clone(&self) -> BencodeAny<'a, 't>
fn clone(&self) -> BencodeAny<'a, 't>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, 't> !Freeze for BencodeAny<'a, 't>
impl<'a, 't> !RefUnwindSafe for BencodeAny<'a, 't>
impl<'a, 't> Send for BencodeAny<'a, 't>
impl<'a, 't> !Sync for BencodeAny<'a, 't>
impl<'a, 't> Unpin for BencodeAny<'a, 't>
impl<'a, 't> UnwindSafe for BencodeAny<'a, 't>
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