Trait reanim_decode::stream::PlainData

source ·
pub trait PlainData: Sized {
    const SIZE_IN_BYTES: usize;
    const TYPE_NAME: &'static str;

    // Required method
    fn from_bytes(data: &[u8]) -> Option<Self>;
}
Expand description

Plain old data, with a constant size known in advance.

Required Associated Constants§

source

const SIZE_IN_BYTES: usize

Size of this data in bytes.

source

const TYPE_NAME: &'static str

Name of this type, used in diagnostics.

Required Methods§

source

fn from_bytes(data: &[u8]) -> Option<Self>

Decode from a byte sequence.

§Note

Length of the input slice is guaranteed to be Self::SIZE_IN_BYTES, but this information cannot be encoded in the type system (yet), due to limitations of min_const_generics.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PlainData for Option<f32>

source§

const SIZE_IN_BYTES: usize = 4usize

source§

const TYPE_NAME: &'static str = "optional f32"

source§

fn from_bytes(data: &[u8]) -> Option<Option<f32>>

source§

impl PlainData for f32

source§

const SIZE_IN_BYTES: usize = 4usize

source§

const TYPE_NAME: &'static str = "f32"

source§

fn from_bytes(data: &[u8]) -> Option<f32>

source§

impl PlainData for f64

source§

const SIZE_IN_BYTES: usize = 8usize

source§

const TYPE_NAME: &'static str = "f64"

source§

fn from_bytes(data: &[u8]) -> Option<f64>

source§

impl PlainData for i8

source§

const SIZE_IN_BYTES: usize = 1usize

source§

const TYPE_NAME: &'static str = "i8"

source§

fn from_bytes(data: &[u8]) -> Option<i8>

source§

impl PlainData for i16

source§

const SIZE_IN_BYTES: usize = 2usize

source§

const TYPE_NAME: &'static str = "i16"

source§

fn from_bytes(data: &[u8]) -> Option<i16>

source§

impl PlainData for i32

source§

const SIZE_IN_BYTES: usize = 4usize

source§

const TYPE_NAME: &'static str = "i32"

source§

fn from_bytes(data: &[u8]) -> Option<i32>

source§

impl PlainData for i64

source§

const SIZE_IN_BYTES: usize = 8usize

source§

const TYPE_NAME: &'static str = "i64"

source§

fn from_bytes(data: &[u8]) -> Option<i64>

source§

impl PlainData for i128

source§

const SIZE_IN_BYTES: usize = 16usize

source§

const TYPE_NAME: &'static str = "i128"

source§

fn from_bytes(data: &[u8]) -> Option<i128>

source§

impl PlainData for u8

source§

const SIZE_IN_BYTES: usize = 1usize

source§

const TYPE_NAME: &'static str = "u8"

source§

fn from_bytes(data: &[u8]) -> Option<u8>

source§

impl PlainData for u16

source§

const SIZE_IN_BYTES: usize = 2usize

source§

const TYPE_NAME: &'static str = "u16"

source§

fn from_bytes(data: &[u8]) -> Option<u16>

source§

impl PlainData for u32

source§

const SIZE_IN_BYTES: usize = 4usize

source§

const TYPE_NAME: &'static str = "u32"

source§

fn from_bytes(data: &[u8]) -> Option<u32>

source§

impl PlainData for u64

source§

const SIZE_IN_BYTES: usize = 8usize

source§

const TYPE_NAME: &'static str = "u64"

source§

fn from_bytes(data: &[u8]) -> Option<u64>

source§

impl PlainData for u128

source§

const SIZE_IN_BYTES: usize = 16usize

source§

const TYPE_NAME: &'static str = "u128"

source§

fn from_bytes(data: &[u8]) -> Option<u128>

Implementors§

source§

impl PlainData for Magic

source§

const SIZE_IN_BYTES: usize = 4usize

source§

const TYPE_NAME: &'static str = "Magic"