Fixed

Trait Fixed 

Source
pub trait Fixed {
    const SIZE: usize;
}
Expand description

Fixed is a trait is defining a single element representing a size of a constant.

This is useful for primitives with a constant fixed size

Types implementing this trait must define the constant SIZE, representing the fixed number of bytes needed to encode or decode the type. This trait is used for types that have a know size at compile time , such as integers, fixed-size arrays, etc.

Required Associated Constants§

Source

const SIZE: usize

the constant SIZE, represents the fixed number of bytes needed to encode or decode the type.

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 Fixed for bool

Source§

const SIZE: usize = 1usize

Source§

impl Fixed for f32

Source§

const SIZE: usize = 4usize

Source§

impl Fixed for u8

Source§

const SIZE: usize = 1usize

Source§

impl Fixed for u16

Source§

const SIZE: usize = 2usize

Source§

impl Fixed for u32

Source§

const SIZE: usize = 4usize

Source§

impl Fixed for u64

Source§

const SIZE: usize = 8usize

Implementors§

Source§

impl Fixed for U24

Source§

const SIZE: usize = 3usize