Skip to main content

ps_uuid/methods/
as_mut_bytes.rs

1use crate::UUID;
2
3impl UUID {
4    #[must_use]
5    pub const fn as_mut_bytes(&mut self) -> &mut [u8; 16] {
6        &mut self.bytes
7    }
8}
9
10#[cfg(test)]
11mod tests {
12    use crate::UUID;
13
14    #[test]
15    fn identity() {
16        let mut uuid = UUID::max();
17
18        uuid.as_mut_bytes()[12] = 3;
19
20        assert_eq!(uuid.bytes[12], 3, "Byte should be modified.");
21    }
22}