Skip to content

Add open_protocol_opt() helpers #1867

@phip1611

Description

@phip1611

This originated from a discussion in #1858. I argue that uefi-rs should aim for abstractions that expose less and less low-level UEFI details to the user. One example I have in mind is open_protocol_opt() -> Result<Option<ScopedProtocol<P>>>. This helps to better differentiate between "is the protocol just not there" and an actual error.

There are many cases both internal code as well as where peope will use uefi-rs where this would be very benefitial.

This cleanly distinguishes between:

  • Ok(None): the protocol is not present
  • Ok(Some(_)): the protocol is present and opened successfully
  • Err(_): a real error occurred

Eventually, we could deprecate the old versions even.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions