Skip to content
Closed
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
23 changes: 23 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,29 @@ where
}

/// Find the first table with the signature `T::SIGNATURE`.
///
/// This returns a `Option<PhysicalMapping<H, T>>`. 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::<Madt>().expect("Failed to find MADT");
///
/// madt.get().entries().for_each(|entry| {
/// match entry {
/// MadtEntry::LocalApic(apic) => {
/// apic.apic_id...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This non-Rust syntax causes the doctests to break.

/// }
/// _ => {
/// }
/// }
/// });
/// ```
pub fn find_table<T>(&self) -> Option<PhysicalMapping<H, T>>
where
T: AcpiTable,
Expand Down