Struct uefi::proto::device_path::DevicePathNode

source ·
#[repr(C, packed(1))]
pub struct DevicePathNode { /* private fields */ }
Expand description

A single node within a DevicePath.

Each node starts with a DevicePathHeader. The rest of the data in the node depends on the type of node. You can “cast” a node to a specific one like this:

use uefi::proto::device_path::DevicePath;
use uefi::proto::device_path::media::FilePath;

let image_device_path: &DevicePath = unsafe { DevicePath::from_ffi_ptr(0x1337 as *const _) };
let file_path = image_device_path
        .node_iter()
        .find_map(|node| {
            let node: &FilePath = node.try_into().ok()?;
            let path = node.path_name().to_cstring16().ok()?;
            Some(path.to_string().to_uppercase())
        });

More types are available in uefi::proto::device_path. Builder types can be found in uefi::proto::device_path::build

See the module-level documentation for more details.

Implementations§

source§

impl DevicePathNode

source

pub unsafe fn from_ffi_ptr<'a>(ptr: *const FfiDevicePath) -> &'a DevicePathNode

Create a DevicePathNode reference from an opaque pointer.

§Safety

The input pointer must point to valid data. That data must remain valid for the lifetime 'a, and cannot be mutated during that lifetime.

source

pub const fn as_ffi_ptr(&self) -> *const FfiDevicePath

Cast to a FfiDevicePath pointer.

source

pub const fn device_type(&self) -> DeviceType

Type of device

source

pub const fn sub_type(&self) -> DeviceSubType

Sub type of device

source

pub const fn full_type(&self) -> (DeviceType, DeviceSubType)

Tuple of the node’s type and subtype.

source

pub const fn length(&self) -> u16

Size (in bytes) of the full DevicePathNode, including the header.

source

pub fn is_end_entire(&self) -> bool

True if this node ends an entire DevicePath.

source

pub fn data(&self) -> &[u8]

Returns the payload data of this node.

source

pub fn as_enum(&self) -> Result<DevicePathNodeEnum<'_>, NodeConversionError>

Convert from a generic DevicePathNode reference to an enum of more specific node types.

source

pub fn to_string( &self, bs: &BootServices, display_only: DisplayOnly, allow_shortcuts: AllowShortcuts ) -> Result<CString16, DevicePathToTextError>

Available on crate feature alloc only.

Transforms the device path node to its string representation using the DevicePathToText protocol.

Trait Implementations§

source§

impl BuildNode for &DevicePathNode

source§

fn size_in_bytes(&self) -> Result<u16, BuildError>

Size of the node in bytes, including the standard node header. Returns BuildError::NodeTooBig if the node’s size does not fit in a u16.
source§

fn write_data(&self, out: &mut [MaybeUninit<u8>])

Write out the node data. Read more
source§

impl Debug for DevicePathNode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for DevicePathNode

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Pointee for DevicePathNode
where [u8]: Pointee,

§

type Metadata = <[u8] as Pointee>::Metadata

The type for metadata in pointers and references to Self.
source§

impl TryFrom<&DevicePathNode> for &Acpi

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Adr

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Atapi

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Bluetooth

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &BluetoothLe

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Bmc

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &BootSpecification

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &CdRom

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Controller

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &DeviceLogicalUnit

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Dns

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Emmc

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Entire

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Expanded

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &FibreChannel

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &FibreChannelEx

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &FilePath

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &HardDrive

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &I2o

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Ieee1394

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Infiniband

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Instance

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Ipv4

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Ipv6

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Iscsi

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &MacAddress

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &MemoryMapped

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Nvdimm

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &NvdimmNamespace

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &NvmeNamespace

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &NvmeOfNamespace

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Pccard

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Pci

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &PiwgFirmwareFile

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &PiwgFirmwareVolume

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Protocol

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &RamDisk

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &RelativeOffsetRange

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &RestService

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &SasEx

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Sata

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Scsi

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Sd

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Uart

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Ufs

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Uri

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Usb

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &UsbClass

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &UsbWwid

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Vendor

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Vendor

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Vendor

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Vlan

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&DevicePathNode> for &Wifi

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&DevicePathNode> for DevicePathNodeEnum<'a>

§

type Error = NodeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for DevicePathNode

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more