FixedSize

Trait FixedSize 

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

Trait for types with a known, fixed encoded size.

Implementing this trait signifies that the encoded representation of this type always has the same byte length, regardless of the specific value.

This automatically provides an implementation of EncodeSize.

Required Associated Constants§

Source

const SIZE: usize

The size of the encoded value (in bytes).

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

Source§

const SIZE: usize = 1usize

Source§

impl FixedSize for f32

Source§

const SIZE: usize = 4usize

Source§

impl FixedSize for f64

Source§

const SIZE: usize = 8usize

Source§

impl FixedSize for i8

Source§

const SIZE: usize = 1usize

Source§

impl FixedSize for i16

Source§

const SIZE: usize = 2usize

Source§

impl FixedSize for i32

Source§

const SIZE: usize = 4usize

Source§

impl FixedSize for i64

Source§

const SIZE: usize = 8usize

Source§

impl FixedSize for i128

Source§

const SIZE: usize = 16usize

Source§

impl FixedSize for u8

Source§

const SIZE: usize = 1usize

Source§

impl FixedSize for u16

Source§

const SIZE: usize = 2usize

Source§

impl FixedSize for u32

Source§

const SIZE: usize = 4usize

Source§

impl FixedSize for u64

Source§

const SIZE: usize = 8usize

Source§

impl FixedSize for u128

Source§

const SIZE: usize = 16usize

Source§

impl FixedSize for Ipv4Addr

Source§

const SIZE: usize = 4usize

Source§

impl FixedSize for Ipv6Addr

Source§

const SIZE: usize = 16usize

Source§

impl FixedSize for SocketAddrV4

Source§

const SIZE: usize = 6usize

Source§

impl FixedSize for SocketAddrV6

Source§

const SIZE: usize = 18usize

Source§

impl<const N: usize> FixedSize for [u8; N]

Source§

const SIZE: usize = N

Implementors§