extern structstd.os.uefi.device_path.DevicePath.Messaging.UsbWwidDevicePath[src]

Fields

type: DevicePath.Type
subtype: Subtype
length: u16 align(1)
interface_number: u16 align(1)
device_vendor_id: u16 align(1)
device_product_id: u16 align(1)

Functions

Functionserial_number[src]

pub fn serial_number(self: *const UsbWwidDevicePath) []align(1) const u16

Parameters

self: *const UsbWwidDevicePath

Source Code

Source code
pub fn serial_number(self: *const UsbWwidDevicePath) []align(1) const u16 {
    const serial_len = (self.length - @sizeOf(UsbWwidDevicePath)) / @sizeOf(u16);
    return @as([*]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(UsbWwidDevicePath)))[0..serial_len];
}

Source Code

Source code
pub const UsbWwidDevicePath = extern struct {
    type: DevicePath.Type,
    subtype: Subtype,
    length: u16 align(1),
    interface_number: u16 align(1),
    device_vendor_id: u16 align(1),
    device_product_id: u16 align(1),

    pub fn serial_number(self: *const UsbWwidDevicePath) []align(1) const u16 {
        const serial_len = (self.length - @sizeOf(UsbWwidDevicePath)) / @sizeOf(u16);
        return @as([*]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(UsbWwidDevicePath)))[0..serial_len];
    }
}