ByteDecodable

Trait ByteDecodable 

Source
pub trait ByteDecodable: Sized {
    // Required method
    fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<Self>
       where Size: BVSize + ByteDecodable;

    // Provided method
    fn decode_max<Size>(bytes: &[u8], limit: Size) -> BVDecodeResult<Self>
       where Size: BVSize + ByteDecodable { ... }
}
Expand description

Provides deserialization functionality for the implementing types.

Required Methods§

Source

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<Self>
where Size: BVSize + ByteDecodable,

Returns an instance of Self obtained from the deserialization of the provided byte buffer.

Provided Methods§

Source

fn decode_max<Size>(bytes: &[u8], limit: Size) -> BVDecodeResult<Self>
where Size: BVSize + ByteDecodable,

Returns the result of decode if bytes.len() is less or equal than limit

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<char>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for f32

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<f32>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for f64

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<f64>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for i8

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<i8>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for i16

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<i16>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for i32

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<i32>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for i64

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<i64>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for u8

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<u8>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for u16

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<u16>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for u32

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<u32>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for u64

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<u64>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for ()

Source§

fn decode<Size>(_: &[u8]) -> BVDecodeResult<()>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for usize

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<usize>
where Size: BVSize + ByteDecodable,

Source§

impl ByteDecodable for String

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<String>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<(H, I, J, K, L)>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<(I, J, K, L)>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<(J, K, L)>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<(K, L)>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<HashMap<K, V>>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<(L,)>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<Vec<T>>
where Size: BVSize + ByteDecodable,

Source§

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

Source§

fn decode<Size>(bytes: &[u8]) -> BVDecodeResult<HashSet<T>>
where Size: BVSize + ByteDecodable,

Implementors§