pub type DataRefType<'a, const N: usize> = Option<&'a [u8; N]>;
Expand description
DataRefType
is a type alias for an optional reference to a fixed-size array of u8
bytes.
This type is similar to DataType
, but instead of owning the key, it holds a reference
to a fixed-size array of u8
bytes, which is useful when the key data is borrowed
rather than owned. It is also parameterized by a constant generic N
, allowing different
sizes of keys to be used with a single type.
DataRefType
is typically used when the key is stored elsewhere in memory, and you want
to reference it without copying or taking ownership of the data. This is useful for
scenarios where the key data already exists and you need to work with it without
transferring ownership.
§Example:
let key_ref: DataRefType<4> = Some(&[1, 2, 3, 4]);
§Fields:
Some(&[u8; N])
: A reference to a fixed-size array ofu8
bytes representing the key.None
: Indicates that the key is not present.
§Type Parameters:
N
: The fixed length of the key array (i.e., the number ofu8
bytes in the key).
§Traits Implemented:
- Implements
Option
, meaning it can beSome
containing a reference to a key orNone
for a missing key
Aliased Type§
enum DataRefType<'a, const N: usize> {
None,
Some(&'a [u8; N]),
}