From 9a3d55380e7cd218421d180cdd0533cee31e949e Mon Sep 17 00:00:00 2001 From: Filippo Casarin Date: Sun, 30 Nov 2025 22:01:36 +0100 Subject: [PATCH] Change `SimpleNetwork::wait_for_packet` to return `Option` A reference to an `Event` is useless since every api takes an `&mut Event`, now we return the `Event` by value. --- uefi/CHANGELOG.md | 2 ++ uefi/src/proto/network/snp.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/uefi/CHANGELOG.md b/uefi/CHANGELOG.md index 31b4df6d7..06f70bc44 100644 --- a/uefi/CHANGELOG.md +++ b/uefi/CHANGELOG.md @@ -10,6 +10,8 @@ ## Changed - Changed ordering of `proto::pci::PciIoAddress` to (bus -> dev -> fun -> reg -> ext_reg). - Return request with status as error data object for `proto::ata::pass_thru::AtaDevice`. +- **Breaking:** `proto::network::snp::SimpleNetwork::wait_for_packet` now + returns `Option` instead of `&Event`. # uefi - v0.36.1 (2025-11-05) diff --git a/uefi/src/proto/network/snp.rs b/uefi/src/proto/network/snp.rs index 4c93189fb..75538abff 100644 --- a/uefi/src/proto/network/snp.rs +++ b/uefi/src/proto/network/snp.rs @@ -270,8 +270,8 @@ impl SimpleNetwork { /// On QEMU, this event seems to never fire; it is suggested to verify that your implementation /// of UEFI properly implements this event before using it. #[must_use] - pub const fn wait_for_packet(&self) -> &Event { - unsafe { &*(ptr::from_ref(&self.0.wait_for_packet).cast::()) } + pub fn wait_for_packet(&self) -> Option { + unsafe { Event::from_ptr(self.0.wait_for_packet) } } /// Returns a reference to the Simple Network mode.