ps_uuid/methods/from_bytes.rs
1use crate::UUID;
2
3impl UUID {
4 #[must_use]
5 pub const fn from_bytes(bytes: [u8; 16]) -> Self {
6 Self { bytes }
7 }
8}
9
10#[cfg(test)]
11mod tests {
12 use crate::{UUID, UUID_BYTES};
13
14 #[test]
15 fn identity() {
16 let bytes = [42u8; UUID_BYTES];
17 let uuid = UUID::from_bytes(bytes);
18
19 assert_eq!(bytes, uuid.bytes, "Arrays should be identical.");
20 }
21}