pub trait BoundedStorable: Storable {
    const MAX_SIZE: u32;
    const IS_FIXED_SIZE: bool;
}
Expand description

A trait indicating that a Storable element is bounded in size.

Required Associated Constants§

source

const MAX_SIZE: u32

The maximum size, in bytes, of the type when serialized.

source

const IS_FIXED_SIZE: bool

True if all the values of this type have fixed-width encoding. Some data structures, such as stable vector, can take advantage of fixed size to avoid storing an explicit entry size.

Examples: little-/big-endian encoding of u16/u32/u64, tuples and arrays of fixed-size types.

Implementations on Foreign Types§

source§

impl BoundedStorable for f32

source§

const MAX_SIZE: u32 = 4u32

source§

const IS_FIXED_SIZE: bool = true

source§

impl<A, B> BoundedStorable for (A, B)where A: BoundedStorable + Default, B: BoundedStorable + Default,

source§

impl BoundedStorable for u64

source§

const MAX_SIZE: u32 = 8u32

source§

const IS_FIXED_SIZE: bool = true

source§

impl BoundedStorable for ()

source§

const MAX_SIZE: u32 = 0u32

source§

const IS_FIXED_SIZE: bool = false

source§

impl BoundedStorable for u16

source§

const MAX_SIZE: u32 = 2u32

source§

const IS_FIXED_SIZE: bool = true

source§

impl BoundedStorable for u8

source§

const MAX_SIZE: u32 = 1u32

source§

const IS_FIXED_SIZE: bool = true

source§

impl BoundedStorable for u128

source§

const MAX_SIZE: u32 = 16u32

source§

const IS_FIXED_SIZE: bool = true

source§

impl BoundedStorable for u32

source§

const MAX_SIZE: u32 = 4u32

source§

const IS_FIXED_SIZE: bool = true

source§

impl BoundedStorable for f64

source§

const MAX_SIZE: u32 = 8u32

source§

const IS_FIXED_SIZE: bool = true

source§

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

source§

impl<T: BoundedStorable> BoundedStorable for Reverse<T>

source§

const MAX_SIZE: u32 = T::MAX_SIZE

source§

const IS_FIXED_SIZE: bool = T::IS_FIXED_SIZE

Implementors§

source§

impl<const N: usize> BoundedStorable for Blob<N>