ByteDeserializeBytes

Trait ByteDeserializeBytes 

Source
pub trait ByteDeserializeBytes<T> {
    // Required method
    fn byte_deserialize(des: &mut ByteDeserializerBytes) -> Result<T>;

    // Provided method
    fn byte_deserialize_take(
        des: &mut ByteDeserializerBytes,
        len: usize,
    ) -> Result<T> { ... }
}
Expand description

This trait is to be implemented by any struct, example MyFavStruct, to be compatible with ByteDeserializerBytes::deserialize<MyFavStruct>()

Required Methods§

Source

fn byte_deserialize(des: &mut ByteDeserializerBytes) -> Result<T>

If successful returns a new instance of T type struct, depleting exactly the right amount of bytes from ByteDeserializerBytes Number of bytes depleted is determined by the struct T itself and its member types.

Provided Methods§

Source

fn byte_deserialize_take( des: &mut ByteDeserializerBytes, len: usize, ) -> Result<T>

if successful returns a new instance of T type struct, however ONLY depleting a maximum of len bytes from ByteDeserializerBytes Intended for types with variable length such as Strings, Vec, etc. No bytes will be depleted if attempt was not successful.

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

Source§

impl ByteDeserializeBytes<String> for String

Source§

impl ByteDeserializeBytes<Bytes> for Bytes

Greedy deserialization of the remaining byte stream into a Vec<u8>

Implementors§