pub enum BluetoothUuid {
Uuid16(BluetoothUuid16),
Uuid32(BluetoothUuid32),
Uuid128(BluetoothUuid128),
}
Expand description
A Bluetooth UUID of any valid length (16, 32, or 128 bits).
Variants§
Uuid16(BluetoothUuid16)
A 16-bit Bluetooth UUID.
Uuid32(BluetoothUuid32)
A 32-bit Bluetooth UUID.
Uuid128(BluetoothUuid128)
A 128-bit Bluetooth UUID.
Implementations§
Source§impl BluetoothUuid
impl BluetoothUuid
Sourcepub const fn nil() -> BluetoothUuid
pub const fn nil() -> BluetoothUuid
Creates a nil (all-zero) UUID.
Sourcepub const fn from_u16(v: u16) -> BluetoothUuid
pub const fn from_u16(v: u16) -> BluetoothUuid
Creates a BluetoothUuid
from a 16-bit unsigned integer.
Sourcepub const fn from_u32(v: u32) -> BluetoothUuid
pub const fn from_u32(v: u32) -> BluetoothUuid
Creates a BluetoothUuid
from a 32-bit unsigned integer.
This will create a Uuid16
if the value fits, otherwise it will create a Uuid32
.
Sourcepub const fn from_u128(v: u128) -> BluetoothUuid
pub const fn from_u128(v: u128) -> BluetoothUuid
Creates a BluetoothUuid
from a 128-bit unsigned integer.
If the 128-bit value corresponds to a standard Bluetooth Base UUID,
it will be shortened to a Uuid16
or Uuid32
representation.
Sourcepub fn from_le_slice(b: &[u8]) -> Result<BluetoothUuid, InvalidLengthError>
pub fn from_le_slice(b: &[u8]) -> Result<BluetoothUuid, InvalidLengthError>
Attempts to create a BluetoothUuid
from a little-endian byte slice.
The slice must have a length of 2, 4, or 16 bytes.
Sourcepub fn from_be_slice(b: &[u8]) -> Result<BluetoothUuid, InvalidLengthError>
pub fn from_be_slice(b: &[u8]) -> Result<BluetoothUuid, InvalidLengthError>
Attempts to create a BluetoothUuid
from a big-endian byte slice.
The slice must have a length of 2, 4, or 16 bytes.
Sourcepub const fn to_u128(&self) -> u128
pub const fn to_u128(&self) -> u128
Converts any BluetoothUuid
variant to its full 128-bit representation.
Sourcepub const fn as_le_slice(&self) -> &[u8]
pub const fn as_le_slice(&self) -> &[u8]
Returns a little-endian byte slice representation of the UUID.
The length of the slice will be 2, 4, or 16 bytes depending on the UUID variant.
Trait Implementations§
Source§impl AsRef<[u8]> for BluetoothUuid
impl AsRef<[u8]> for BluetoothUuid
Source§impl Clone for BluetoothUuid
impl Clone for BluetoothUuid
Source§fn clone(&self) -> BluetoothUuid
fn clone(&self) -> BluetoothUuid
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more