From 090182a3e61b6b0edc9c67e071e91405ae73f231 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sun, 23 Jun 2024 19:33:12 +0200 Subject: [PATCH] uefi: simplify usage of Mode --- uefi/CHANGELOG.md | 3 +++ uefi/src/proto/console/gop.rs | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/uefi/CHANGELOG.md b/uefi/CHANGELOG.md index 975680c24..07bbabc35 100644 --- a/uefi/CHANGELOG.md +++ b/uefi/CHANGELOG.md @@ -20,6 +20,7 @@ - `MemoryMap::as_raw` which provides raw access to the memory map. This is for example useful if you create your own Multiboot2 bootloader that embeds the EFI mmap in a Multiboot2 boot information structure. +- `Mode` is now `Copy` and `Clone` ## Changed - `SystemTable::exit_boot_services` is now `unsafe`. See that method's @@ -35,6 +36,8 @@ returned type is automatically freed on the UEFI heap, as long as boot services are not excited. By removing the need for that explicit buffer and the lifetime, the API is simpler. +- `GraphicsOutput::query_mode` is now private. Use `GraphicsOutput::modes` + instead. ## Removed - Removed the `panic-on-logger-errors` feature of the `uefi` crate. Logger diff --git a/uefi/src/proto/console/gop.rs b/uefi/src/proto/console/gop.rs index 351dc0c89..5ae81596d 100644 --- a/uefi/src/proto/console/gop.rs +++ b/uefi/src/proto/console/gop.rs @@ -76,7 +76,7 @@ pub struct GraphicsOutput(GraphicsOutputProtocol); impl GraphicsOutput { /// Returns information for an available graphics mode that the graphics /// device and the set of active video output devices supports. - pub fn query_mode(&self, index: u32, bs: &BootServices) -> Result { + fn query_mode(&self, index: u32, bs: &BootServices) -> Result { let mut info_sz = 0; let mut info_heap_ptr = ptr::null(); // query_mode allocates a buffer and stores the heap ptr in the provided @@ -100,7 +100,7 @@ impl GraphicsOutput { }) } - /// Returns information about all available graphics modes. + /// Returns a [`ModeIter`]. #[must_use] pub fn modes<'a>(&'a self, bs: &'a BootServices) -> ModeIter { ModeIter { @@ -336,7 +336,7 @@ pub enum PixelFormat { } /// Represents a graphics mode compatible with a given graphics device. -#[derive(Debug)] +#[derive(Copy, Clone, Debug)] pub struct Mode { index: u32, info_sz: usize,