[][src]Trait bendy::encoding::ToBencode

pub trait ToBencode {
    const MAX_DEPTH: usize;

    fn encode(&self, encoder: SingleItemEncoder<'_>) -> Result<(), Error>;

    fn to_bencode(&self) -> Result<Vec<u8>, Error> { ... }
}

An object that can be encoded into a single bencode object

Associated Constants

const MAX_DEPTH: usize

The maximum depth that this object could encode to. Leaves do not consume a level, so an i1e has depth 0 and li1ee has depth 1.

Loading content...

Required methods

fn encode(&self, encoder: SingleItemEncoder<'_>) -> Result<(), Error>

Encode this object into the bencode stream

Loading content...

Provided methods

fn to_bencode(&self) -> Result<Vec<u8>, Error>

Encode this object to a byte string

Loading content...

Implementations on Foreign Types

impl<'a, E: 'a + ToBencode + Sized> ToBencode for &'a E[src]

impl<E: ToBencode> ToBencode for Box<E>[src]

impl<E: ToBencode> ToBencode for Rc<E>[src]

impl<E: ToBencode> ToBencode for Arc<E>[src]

impl<'a> ToBencode for &'a str[src]

impl ToBencode for String[src]

impl ToBencode for u8[src]

impl ToBencode for u16[src]

impl ToBencode for u32[src]

impl ToBencode for u64[src]

impl ToBencode for u128[src]

impl ToBencode for usize[src]

impl ToBencode for i8[src]

impl ToBencode for i16[src]

impl ToBencode for i32[src]

impl ToBencode for i64[src]

impl ToBencode for i128[src]

impl ToBencode for isize[src]

impl<ContentT> ToBencode for Vec<ContentT> where
    ContentT: ToBencode
[src]

impl<ContentT> ToBencode for VecDeque<ContentT> where
    ContentT: ToBencode
[src]

impl<ContentT> ToBencode for LinkedList<ContentT> where
    ContentT: ToBencode
[src]

impl<'a, ContentT> ToBencode for &'a [ContentT] where
    ContentT: ToBencode
[src]

impl<K: AsRef<[u8]>, V: ToBencode> ToBencode for BTreeMap<K, V>[src]

impl<K, V, S> ToBencode for HashMap<K, V, S> where
    K: AsRef<[u8]> + Eq + Hash,
    V: ToBencode,
    S: BuildHasher
[src]

Loading content...

Implementors

impl<'a> ToBencode for Value<'a>[src]

impl<I> ToBencode for AsString<I> where
    I: AsRef<[u8]>, 
[src]

Loading content...