use crate::Id;
use std::marker::PhantomData;
impl<Label, const SIZE: usize> From<[u8; SIZE]> for Id<Label, SIZE> {
fn from(data: [u8; SIZE]) -> Self {
Self {
data,
_phantom: PhantomData,
}
}
}
impl<Label, const SIZE: usize> Into<[u8; SIZE]> for Id<Label, SIZE> {
fn into(self) -> [u8; SIZE] {
self.data
}
}
#[test]
fn test_conversions() {
let id: Id<(), 3> = [0, 1, 2].into();
let bytes: [u8; 3] = id.into();
assert_eq!(bytes, [0, 1, 2]);
}