Skip to main content

uuid/
v8.rs

1use crate::{Uuid, Version};
2
3impl Uuid {
4    pub fn new_v8(buf: [u8; 16]) -> Uuid {
5        let mut uuid = Uuid::from_bytes(buf);
6        // Version: 8
7        uuid.0[6] = (uuid.0[6] & 0x0f) | ((Version::V8 as u8) << 4);
8        // Variant: RFC4122
9        uuid.0[8] = (uuid.0[8] & 0x3F) | 0x80;
10        return uuid;
11    }
12}