Skip to main content

FixedStorage

Trait FixedStorage 

Source
pub trait FixedStorage { }
Expand description

Marker trait asserting that a type owns no heap allocation.

Required by Fixed::new. See the module documentation for the contract, for what is already implemented, and for why this is an assertion rather than an enforcement.

No methods — its only purpose is to gate construction of a Fixed<T>.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FixedStorage for ()

Source§

impl FixedStorage for NonZeroI8

Source§

impl FixedStorage for NonZeroI16

Source§

impl FixedStorage for NonZeroI32

Source§

impl FixedStorage for NonZeroI64

Source§

impl FixedStorage for NonZeroI128

Source§

impl FixedStorage for NonZeroIsize

Source§

impl FixedStorage for NonZeroU8

Source§

impl FixedStorage for NonZeroU16

Source§

impl FixedStorage for NonZeroU32

Source§

impl FixedStorage for NonZeroU64

Source§

impl FixedStorage for NonZeroU128

Source§

impl FixedStorage for NonZeroUsize

Source§

impl FixedStorage for bool

Source§

impl FixedStorage for char

Source§

impl FixedStorage for f32

Source§

impl FixedStorage for f64

Source§

impl FixedStorage for i8

Source§

impl FixedStorage for i16

Source§

impl FixedStorage for i32

Source§

impl FixedStorage for i64

Source§

impl FixedStorage for i128

Source§

impl FixedStorage for isize

Source§

impl FixedStorage for u8

Source§

impl FixedStorage for u16

Source§

impl FixedStorage for u32

Source§

impl FixedStorage for u64

Source§

impl FixedStorage for u128

Source§

impl FixedStorage for usize

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage, E: FixedStorage, F: FixedStorage, G: FixedStorage, H: FixedStorage, I: FixedStorage, J: FixedStorage> FixedStorage for (A, B, C, D, E, F, G, H, I, J)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage, E: FixedStorage, F: FixedStorage, G: FixedStorage, H: FixedStorage, I: FixedStorage> FixedStorage for (A, B, C, D, E, F, G, H, I)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage, E: FixedStorage, F: FixedStorage, G: FixedStorage, H: FixedStorage> FixedStorage for (A, B, C, D, E, F, G, H)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage, E: FixedStorage, F: FixedStorage, G: FixedStorage> FixedStorage for (A, B, C, D, E, F, G)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage, E: FixedStorage, F: FixedStorage> FixedStorage for (A, B, C, D, E, F)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage, E: FixedStorage> FixedStorage for (A, B, C, D, E)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage, D: FixedStorage> FixedStorage for (A, B, C, D)

Source§

impl<A: FixedStorage, B: FixedStorage, C: FixedStorage> FixedStorage for (A, B, C)

Source§

impl<A: FixedStorage, B: FixedStorage> FixedStorage for (A, B)

Source§

impl<A: FixedStorage> FixedStorage for (A,)

Source§

impl<T: FixedStorage + Zeroize> FixedStorage for Zeroizing<T>

zeroize::Zeroizing<T> holds T inline and wipes it on drop, so it qualifies exactly when T does.

This one matters out of proportion to its size. Zeroizing is the idiomatic “wipe this on drop” wrapper from this crate’s only non-optional dependency, so Fixed<Zeroizing<[u8; 32]>> is a shape people reach for — and because both the trait and the type are foreign to the caller, the orphan rule leaves them no way to assert it. It has to be here or it is unavailable.

Source§

impl<T: FixedStorage, const N: usize> FixedStorage for [T; N]

An array never reallocates, whatever its length, so it is FixedStorage exactly when its element type is. This is the impl that covers [u8; N] and the non-byte arrays the generic arm of fixed_newtype! exists for.

Source§

impl<T: FixedStorage> FixedStorage for MaybeUninit<T>

MaybeUninit<T> is T’s storage, initialised or not. No allocation either way.

Source§

impl<T: FixedStorage> FixedStorage for Option<T>

An Option adds a discriminant and no heap storage, so it qualifies exactly when its payload does. Option<[u8; 32]> is a legitimate fixed-size secret; Option<Vec<u8>> and Option<Box<[u8]>> are both rejected, which is the point.

Source§

impl<T: FixedStorage> FixedStorage for Wrapping<T>

Wrapping is a transparent arithmetic wrapper: same storage as its payload.

Implementors§

Source§

impl<T: Zeroize + FixedStorage> FixedStorage for Fixed<T>

A Fixed<T> holds T inline, so the wrapper nests: Fixed<Fixed<[u8; 32]>> is legal exactly when the payload qualifies. Without this impl the crate’s own wrapper could not be used as its own inner type.