pub trait BRefAccess: Sized {
    type BKey;
    type BType: BRefAccess<BKey = Self::BKey>;

    // Required methods
    fn kind(&self) -> RefKind<'_, Self::BKey, Self::BType>;
    fn str(&self) -> Option<&str>;
    fn int(&self) -> Option<i64>;
    fn bytes(&self) -> Option<&[u8]>;
    fn list(&self) -> Option<&dyn BListAccess<Self::BType>>;
    fn dict(&self) -> Option<&dyn BDictAccess<Self::BKey, Self::BType>>;
}
Expand description

Trait for read access to some bencode type.

Required Associated Types§

source

type BKey

source

type BType: BRefAccess<BKey = Self::BKey>

Required Methods§

source

fn kind(&self) -> RefKind<'_, Self::BKey, Self::BType>

Access the bencode as a BencodeRefKind.

source

fn str(&self) -> Option<&str>

Attempt to access the bencode as a str.

source

fn int(&self) -> Option<i64>

Attempt to access the bencode as an i64.

source

fn bytes(&self) -> Option<&[u8]>

Attempt to access the bencode as an [u8].

source

fn list(&self) -> Option<&dyn BListAccess<Self::BType>>

Attempt to access the bencode as an BListAccess.

source

fn dict(&self) -> Option<&dyn BDictAccess<Self::BKey, Self::BType>>

Attempt to access the bencode as an BDictAccess.

Implementations on Foreign Types§

source§

impl<'a, T> BRefAccess for &'a Twhere T: BRefAccess,

§

type BKey = <T as BRefAccess>::BKey

§

type BType = <T as BRefAccess>::BType

source§

fn kind(&self) -> RefKind<'_, Self::BKey, Self::BType>

source§

fn str(&self) -> Option<&str>

source§

fn int(&self) -> Option<i64>

source§

fn bytes(&self) -> Option<&[u8]>

source§

fn list(&self) -> Option<&dyn BListAccess<Self::BType>>

source§

fn dict(&self) -> Option<&dyn BDictAccess<Self::BKey, Self::BType>>

Implementors§

source§

impl<'a> BRefAccess for BencodeMut<'a>

§

type BKey = Cow<'a, [u8]>

§

type BType = BencodeMut<'a>

source§

impl<'a> BRefAccess for BencodeRef<'a>

§

type BKey = &'a [u8]

§

type BType = BencodeRef<'a>