BRefAccess

Trait BRefAccess 

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

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

Source§

type BKey = <T as BRefAccess>::BKey

Source§

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>

Source§

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

Source§

type BType = BencodeMut<'a>

Source§

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

Source§

type BKey = &'a [u8]

Source§

type BType = BencodeRef<'a>