From 508cdfe6ab4ca64854905c15c4cd93490ef862b7 Mon Sep 17 00:00:00 2001 From: Staarblitz <229130767+staarblitz@users.noreply.github.com> Date: Fri, 26 Jun 2026 01:55:45 +0300 Subject: [PATCH] Add documentation --- src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 91b53697..69bdc5f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -200,6 +200,29 @@ where } /// Find the first table with the signature `T::SIGNATURE`. + /// + /// This returns a `Option>`. If `T` is `!Unpin` use the [`PhysicalMapping::get`] to dereference the inner `T`. + /// + /// ## Example + /// ```rust + /// use acpi::AcpiTables; + /// use acpi::sdt::madt::{Madt, MadtEntry}; + /// + /// let tables = unsafe { AcpiTables::from_rsdp(AcpiHandler, rsdp.as_ptr().addr()) } + /// .unwrap_or_else(|x| panic!("Failed to parse RSDP table: {:?}", x)); + /// + /// let mut madt = tables.find_table::().expect("Failed to find MADT"); + /// + /// madt.get().entries().for_each(|entry| { + /// match entry { + /// MadtEntry::LocalApic(apic) => { + /// apic.apic_id... + /// } + /// _ => { + /// } + /// } + /// }); + /// ``` pub fn find_table(&self) -> Option> where T: AcpiTable,