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
40
41
42
43
44
use Debug;
/// Marks a type as an identifier for the inner `DataType`, which can be transferred via a slot.
///
/// # Usage
///
/// The trait allows separating the data type from the identifier type.
/// This allows registering multiple data type of the same type with unique identifiers, avoiding collisions.
///
/// This trait can be derived via the [`Storable`][derive@crate::datastore::Storable] derive macro,
/// see its documentation for more details.
///
/// ```
/// use veecle_os_runtime::Storable;
///
/// // Identifier type.
/// #[derive(Debug, Default)]
/// struct Sensor;
///
/// impl Storable for Sensor {
/// // Data type.
/// type DataType = u8;
/// }
/// ```
///
/// If the data type is unique and should be used as the identifier, the data type can be set to `Self`.
/// ```
/// use veecle_os_runtime::Storable;
///
/// // Identifier type.
/// #[derive(Debug, Default)]
/// struct Sensor{
/// // ...
/// };
///
/// impl Storable for Sensor {
/// // Data type.
/// type DataType = Self;
/// }
/// ```