ByteEncodable

Trait ByteEncodable 

Source
pub trait ByteEncodable {
    // Required methods
    fn get_size<Size>(&self) -> Option<Size>
       where Size: BVSize + ByteEncodable;
    fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
       where Size: BVSize + ByteEncodable;
}
Expand description

Provides serialization functionality for the implementing types.

Required Methods§

Source

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Returns the total length of the byte buffer than can be obtained through the encode method

Source

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Returs a byte representation of the original data object

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 ByteEncodable for char

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for f32

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for f64

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for i8

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for i16

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for i32

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for i64

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for str

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for u8

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for u16

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for u32

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for u64

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for ()

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for usize

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl ByteEncodable for String

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a> ByteEncodable for &'a str

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L> ByteEncodable for &'a (&'a A, &'a B, &'a C, &'a D, &'a E, &'a F, &'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, B, C, D, E, F, G, H, I, J, K, L> ByteEncodable for &'a (&'a B, &'a C, &'a D, &'a E, &'a F, &'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, C, D, E, F, G, H, I, J, K, L> ByteEncodable for &'a (&'a C, &'a D, &'a E, &'a F, &'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, D, E, F, G, H, I, J, K, L> ByteEncodable for &'a (&'a D, &'a E, &'a F, &'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, E, F, G, H, I, J, K, L> ByteEncodable for &'a (&'a E, &'a F, &'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, F, G, H, I, J, K, L> ByteEncodable for &'a (&'a F, &'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, G, H, I, J, K, L> ByteEncodable for &'a (&'a G, &'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, H, I, J, K, L> ByteEncodable for &'a (&'a H, &'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, I, J, K, L> ByteEncodable for &'a (&'a I, &'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, J, K, L> ByteEncodable for &'a (&'a J, &'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, K, L> ByteEncodable for &'a (&'a K, &'a L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<'a, L> ByteEncodable for &'a (&'a L,)
where L: ByteEncodable,

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> ByteEncodable for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<B, C, D, E, F, G, H, I, J, K, L> ByteEncodable for (B, C, D, E, F, G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<C, D, E, F, G, H, I, J, K, L> ByteEncodable for (C, D, E, F, G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<D, E, F, G, H, I, J, K, L> ByteEncodable for (D, E, F, G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<E, F, G, H, I, J, K, L> ByteEncodable for (E, F, G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<F, G, H, I, J, K, L> ByteEncodable for (F, G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<G, H, I, J, K, L> ByteEncodable for (G, H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<H, I, J, K, L> ByteEncodable for (H, I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<I, J, K, L> ByteEncodable for (I, J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<J, K, L> ByteEncodable for (J, K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<K, L> ByteEncodable for (K, L)

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<K, V> ByteEncodable for HashMap<K, V>

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<L> ByteEncodable for (L,)
where L: ByteEncodable,

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<T> ByteEncodable for [T]
where T: ByteEncodable,

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<T> ByteEncodable for Vec<T>
where T: ByteEncodable,

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Source§

impl<T> ByteEncodable for HashSet<T>
where T: ByteEncodable + Eq + Hash,

Source§

fn get_size<Size>(&self) -> Option<Size>
where Size: BVSize + ByteEncodable,

Source§

fn encode<Size>(&self) -> BVEncodeResult<Vec<u8>>
where Size: BVSize + ByteEncodable,

Implementors§