ps_uuid/node_id/implementations/from/array.rs
1use crate::{NodeId, NODE_ID_BYTES};
2
3impl From<[u8; NODE_ID_BYTES]> for NodeId {
4 fn from(bytes: [u8; NODE_ID_BYTES]) -> Self {
5 Self { bytes }
6 }
7}
8
9#[cfg(test)]
10mod tests {
11 use crate::NodeId;
12
13 #[test]
14 fn identity() {
15 let bytes = [1, 2, 3, 4, 5, 6];
16 let node_id = NodeId::from(bytes);
17
18 assert_eq!(bytes, node_id.bytes, "Arrays should be identical.");
19 }
20}