Skip to main content

BencodeVariable

Trait BencodeVariable 

Source
pub trait BencodeVariable:
    Display
    + Debug
    + ToBencode
    + FromBencode {
    // Required methods
    fn get_type(&self) -> BencodeTypes;
    fn upcast(self) -> Box<dyn BencodeVariable>;
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
    fn clone_box(&self) -> Box<dyn BencodeVariable>;

    // Provided method
    fn parse<V>(&self) -> Result<V>
       where V: BencodeCast<Self>,
             Self: Sized { ... }
}

Required Methods§

Source

fn get_type(&self) -> BencodeTypes

Source

fn upcast(self) -> Box<dyn BencodeVariable>

Source

fn as_any(&self) -> &dyn Any

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Source

fn clone_box(&self) -> Box<dyn BencodeVariable>

Provided Methods§

Source

fn parse<V>(&self) -> Result<V>
where V: BencodeCast<Self>, Self: Sized,

Trait Implementations§

Source§

impl AddArray<Box<dyn BencodeVariable>> for BencodeArray

Source§

fn push(&mut self, value: Box<dyn BencodeVariable>)

Source§

fn insert(&mut self, index: usize, value: Box<dyn BencodeVariable>)

Source§

impl Clone for Box<dyn BencodeVariable>

Source§

fn clone(&self) -> Box<dyn BencodeVariable>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<&String> for Box<dyn BencodeVariable>

Source§

fn from(value: &String) -> Self

Converts to this type from the input type.
Source§

impl From<&Vec<u8>> for Box<dyn BencodeVariable>

Source§

fn from(value: &Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<&[u8]> for Box<dyn BencodeVariable>

Source§

fn from(value: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Box<dyn BencodeVariable>

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Box<dyn BencodeVariable>

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Box<dyn BencodeVariable>

Source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[u8; N]> for Box<dyn BencodeVariable>

Source§

fn from(value: [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Box<dyn BencodeVariable>

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Box<dyn BencodeVariable>

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Box<dyn BencodeVariable>

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Box<dyn BencodeVariable>

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Box<dyn BencodeVariable>

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Box<dyn BencodeVariable>

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Box<dyn BencodeVariable>

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Box<dyn BencodeVariable>

Source§

fn from(value: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Box<dyn BencodeVariable>

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Box<dyn BencodeVariable>

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Box<dyn BencodeVariable>

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Box<dyn BencodeVariable>

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Box<dyn BencodeVariable>

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Box<dyn BencodeVariable>

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl PutObject<&String, Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: &String, value: Box<dyn BencodeVariable>)

Source§

impl PutObject<&Vec<u8>, Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: &Vec<u8>, value: Box<dyn BencodeVariable>)

Source§

impl PutObject<&[u8], Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: &[u8], value: Box<dyn BencodeVariable>)

Source§

impl PutObject<&str, Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: &str, value: Box<dyn BencodeVariable>)

Source§

impl PutObject<BencodeBytes, Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: BencodeBytes, value: Box<dyn BencodeVariable>)

Source§

impl PutObject<String, Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: String, value: Box<dyn BencodeVariable>)

Source§

impl PutObject<Vec<u8>, Box<dyn BencodeVariable>> for BencodeObject

Source§

fn put(&mut self, key: Vec<u8>, value: Box<dyn BencodeVariable>)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§