Skip to main content

TransparentRawStorage

Trait TransparentRawStorage 

Source
pub unsafe trait TransparentRawStorage: RawStorage { }
Expand description

Raw storage which is laid out exactly like its RawStorage::Value.

This is implemented for SetStorage when the #[key(bitset)] attribute is present, and lets Set implement layout-dependent traits like ZeroCopy from musli-zerocopy.

§Safety

The implementor must be #[repr(transparent)] over a single field of type RawStorage::Value, every bit pattern of that value must be a valid instance of the storage, and RawStorage::as_raw and RawStorage::from_raw must copy that field unchanged.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§