uefi/data_types/
guid.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3pub use uguid::Guid;
4
5/// Several entities in the UEFI specification can be referred to by their GUID,
6/// this trait is a building block to interface them in uefi-rs.
7///
8/// You should never need to use the `Identify` trait directly, but instead go
9/// for more specific traits such as [`Protocol`] or [`FileProtocolInfo`], which
10/// indicate in which circumstances an `Identify`-tagged type should be used.
11///
12/// For the common case of implementing this trait for a protocol, use
13/// the [`unsafe_protocol`] macro.
14///
15/// # Safety
16///
17/// Implementing `Identify` is unsafe because attaching an incorrect GUID to a
18/// type can lead to type unsafety on both the Rust and UEFI side.
19///
20/// [`Protocol`]: crate::proto::Protocol
21/// [`FileProtocolInfo`]: crate::proto::media::file::FileProtocolInfo
22/// [`unsafe_protocol`]: crate::proto::unsafe_protocol
23pub unsafe trait Identify {
24    /// Unique protocol identifier.
25    const GUID: Guid;
26}