@@ -179,7 +179,47 @@ fn get_function_arg_name(f: &ItemFn, arg_index: usize, errors: &mut TokenStream2
179179 }
180180}
181181
182- /// Custom attribute for a UEFI executable entrypoint
182+ /// Custom attribute for a UEFI executable entry point.
183+ ///
184+ /// This attribute modifies a function to mark it as the entry point for
185+ /// a UEFI executable. The function must have two parameters, [`Handle`]
186+ /// and [`SystemTable<Boot>`], and return a [`Status`]. The function can
187+ /// optionally be `unsafe`.
188+ ///
189+ /// Due to internal implementation details the parameters must both be
190+ /// named, so `arg` or `_arg` are allowed, but not `_`.
191+ ///
192+ /// The [`BootServices::set_image_handle`] function will be called
193+ /// automatically with the image [`Handle`] argument.
194+ ///
195+ /// # Examples
196+ ///
197+ /// ```no_run
198+ /// #![no_main]
199+ /// #![no_std]
200+ /// #![feature(abi_efiapi)]
201+ /// # // A bit of boilerplate needed to make the example compile in the
202+ /// # // context of `cargo test`.
203+ /// # #![feature(lang_items)]
204+ /// # #[lang = "eh_personality"]
205+ /// # fn eh_personality() {}
206+ /// # #[panic_handler]
207+ /// # fn panic_handler(info: &core::panic::PanicInfo) -> ! {
208+ /// # loop {}
209+ /// # }
210+ ///
211+ /// use uefi::prelude::*;
212+ ///
213+ /// #[entry]
214+ /// fn main(image: Handle, st: SystemTable<Boot>) -> Status {
215+ /// Status::SUCCESS
216+ /// }
217+ /// ```
218+ ///
219+ /// [`Handle`]: https://docs.rs/uefi/latest/uefi/data_types/struct.Handle.html
220+ /// [`SystemTable<Boot>`]: https://docs.rs/uefi/latest/uefi/table/struct.SystemTable.html
221+ /// [`Status`]: https://docs.rs/uefi/latest/uefi/struct.Status.html
222+ /// [`BootServices::set_image_handle`]: https://docs.rs/uefi/latest/uefi/table/boot/struct.BootServices.html#method.set_image_handle
183223#[ proc_macro_attribute]
184224pub fn entry ( args : TokenStream , input : TokenStream ) -> TokenStream {
185225 // This code is inspired by the approach in this embedded Rust crate:
0 commit comments