Skip to content

Update Protocol/unsafe_protocol docs #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions uefi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ macro_rules! err {

/// Attribute macro for marking structs as UEFI protocols.
///
/// The macro takes one argument, either a GUID string or the path to a `Guid`
/// constant.
/// The macro can only be applied to a struct, and takes one argument, either a
/// GUID string or the path to a `Guid` constant.
///
/// The macro can only be applied to a struct. It implements the
/// [`Protocol`] trait and the `unsafe` [`Identify`] trait for the
/// struct.
/// The macro implements the [`Protocol`] trait and the `unsafe` [`Identify`]
/// trait for the struct. See the [`Protocol`] trait for details of how it is
/// used.
///
/// # Safety
///
Expand All @@ -55,7 +55,7 @@ macro_rules! err {
/// assert_eq!(ExampleProtocol2::GUID, PROTO_GUID);
/// ```
///
/// [`Identify`]: https://docs.rs/uefi/latest/uefi/trait.Identify.html
/// [`Identify`]: https://docs.rs/uefi/latest/uefi/data_types/trait.Identify.html
/// [`Protocol`]: https://docs.rs/uefi/latest/uefi/proto/trait.Protocol.html
/// [send-and-sync]: https://doc.rust-lang.org/nomicon/send-and-sync.html
#[proc_macro_attribute]
Expand Down
14 changes: 11 additions & 3 deletions uefi/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ pub use uefi_macros::unsafe_protocol;
use crate::Identify;
use core::ffi::c_void;

/// Common trait implemented by all standard UEFI protocols.
#[cfg(doc)]
use crate::boot;

/// Marker trait for structures that represent UEFI protocols.
///
/// Implementing this trait allows a protocol to be opened with
/// [`boot::open_protocol`] or [`boot::open_protocol_exclusive`]. Note that
/// implementing this trait does not automatically install a protocol. To
/// install a protocol, call [`boot::install_protocol_interface`].
///
/// You can derive the `Protocol` trait and specify the protocol's GUID using
/// the [`unsafe_protocol`] macro.
/// As a convenience, you can derive the `Protocol` trait and specify the
/// protocol's GUID using the [`unsafe_protocol`] macro.
///
/// # Example
///
Expand Down
Loading