pub fn from_slice(bytes: &[u8]) -> Self {
        Self(match bytes.len() {
            2 => {
                let mut r = BASE_UUID_BYTES;
                r[2] = bytes[0];
                r[3] = bytes[1];
                r
            }
            4 => {
                let mut r = BASE_UUID_BYTES;
                r[0] = bytes[0];
                r[1] = bytes[1];
                r[2] = bytes[2];
                r[3] = bytes[3];
                r
            }
            16 => {
                let mut r = [0; 16];
                r.copy_from_slice(bytes);
                r
            }
            _ => panic!("invalid slice len {}, expected 2, 4 or 16 bytes", bytes.len()),
        })
    }
/// Constructs instance from the specified slice of variable length.
/// The supported lengths are 2 for `uuid16`, 4 for `uuid32` and 16 for a standard UUID.
///
/// # Panics
///
/// Panics if `bytes` length is not 2, 4 or 16.
Constructs instance from the specified slice of variable length.
The supported lengths are 2 for `uuid16`, 4 for `uuid32` and 16 for a standard UUID.
Constructs instance from the specified slice of variable length . The supported lengths are 2 for ` uuid16 ` 4 for ` uuid32 ` and 16 for a standard UUID .
pub fn from_slice(bytes: &[u8]) -> Self {
        Self(match bytes.len() {
            2 => {
                let mut r = BASE_UUID_BYTES;
                r[2] = bytes[0];
                r[3] = bytes[1];
                r
            }
            4 => {
                let mut r = BASE_UUID_BYTES;
                r[0] = bytes[0];
                r[1] = bytes[1];
                r[2] = bytes[2];
                r[3] = bytes[3];
                r
            }
            16 => {
                let mut r = [0; 16];
                r.copy_from_slice(bytes);
                r
            }
            _ => panic!("invalid slice len {}, expected 2, 4 or 16 bytes", bytes.len()),
        })
    }
pub fn from_slice ( bytes : & [ u8 ] ) -> Self { Self ( match bytes . len ( ) { 2 => { let mut r = BASE_UUID_BYTES ; r [ 2 ] = bytes [ 0 ] ; r [ 3 ] = bytes [ 1 ] ; r } 4 => { let mut r = BASE_UUID_BYTES ; r [ 0 ] = bytes [ 0 ] ; r [ 1 ] = bytes [ 1 ] ; r [ 2 ] = bytes [ 2 ] ; r [ 3 ] = bytes [ 3 ] ; r } 16 => { let mut r = [ 0 ; 16 ] ; r . copy_from_slice ( bytes ) ; r } _ => panic ! ( " " bytes len ( ) ) , } ) }
Constructs instance from the specified slice of variable length.
Constructs instance from the specified slice of variable length .
bytes
&[u8]
bytes
&[u8]
panics
Panics if `bytes` length is not 2, 4 or 16.
Panics if ` bytes ` length is not 2 4 or 16 .