1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Raw access to underlying storage.
//!
//! This can be useful to implement more efficient serialization, since it might
//! provide access to smaller primitive values.
/// Trait implemented for storage which can be easily converted to and from a
/// raw value.
///
/// This is implemented for [`SetStorage`] when the `#[key(bitset)]` attribute
/// is present.
///
/// [`SetStorage`]: crate::set::SetStorage
/// 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.
///
/// [`SetStorage`]: crate::set::SetStorage
/// [`Set`]: crate::Set
pub unsafe