Struct uefi::table::boot::ScopedProtocol

source ·
pub struct ScopedProtocol<'a, P: Protocol + ?Sized> { /* private fields */ }
Expand description

An open protocol interface. Automatically closes the protocol interface on drop.

Most protocols have interface data associated with them. ScopedProtocol implements Deref and DerefMut to access this data. A few protocols (such as DevicePath and LoadedImageDevicePath) may be installed with null interface data, in which case Deref and DerefMut will panic. The get and get_mut methods may be used to access the optional interface data without panicking.

See also the BootServices documentation for details of how to open a protocol and why UnsafeCell is used.

Implementations§

source§

impl<'a, P: Protocol + ?Sized> ScopedProtocol<'a, P>

source

pub fn get(&self) -> Option<&P>

Get the protocol interface data, or None if the open protocol’s interface is null.

source

pub fn get_mut(&self) -> Option<&mut P>

Get the protocol interface data, or None if the open protocol’s interface is null.

Trait Implementations§

source§

impl<'a, P: Debug + Protocol + ?Sized> Debug for ScopedProtocol<'a, P>

source§

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

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

impl<'a, P: Protocol + ?Sized> Deref for ScopedProtocol<'a, P>

§

type Target = P

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a, P: Protocol + ?Sized> DerefMut for ScopedProtocol<'a, P>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, P: Protocol + ?Sized> Drop for ScopedProtocol<'a, P>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, P> Freeze for ScopedProtocol<'a, P>
where P: ?Sized,

§

impl<'a, P> !RefUnwindSafe for ScopedProtocol<'a, P>

§

impl<'a, P> !Send for ScopedProtocol<'a, P>

§

impl<'a, P> !Sync for ScopedProtocol<'a, P>

§

impl<'a, P> Unpin for ScopedProtocol<'a, P>
where P: ?Sized,

§

impl<'a, P> !UnwindSafe for ScopedProtocol<'a, P>

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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointee for T

§

type Metadata = ()

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.