Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi/src/fs/dir_entry_iter.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi / src / fs / dir_entry_iter.rs` 40 lines ยท 1132 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 //! Module for directory iteration. See [`UefiDirectoryIter`]. 4 5 use super::*; 6 use crate::{CStr16, Result, cstr16}; 7 use alloc::boxed::Box; 8 9 /// Common skip dirs in UEFI/FAT-style file systems. 10 pub const COMMON_SKIP_DIRS: &[&CStr16] = &[cstr16!("."), cstr16!("..")]; 11 12 /// Iterates over the entries of a UEFI directory. It returns boxed values of 13 /// type [`UefiFileInfo`]. 14 /// 15 /// Note that on UEFI/FAT-style file systems, the root dir usually doesn't 16 /// return the entries `.` and `..`, whereas sub directories do. 17 #[derive(Debug)] 18 pub struct UefiDirectoryIter(UefiDirectoryHandle); 19 20 impl UefiDirectoryIter { 21 /// Constructor. 22 #[must_use] 23 pub const fn new(handle: UefiDirectoryHandle) -> Self { 24 Self(handle) 25 } 26 } 27 28 impl Iterator for UefiDirectoryIter { 29 type Item = Result, ()>; 30 31 fn next(&mut self) -> Option { 32 let e = self.0.read_entry_boxed(); 33 match e { 34 // no more entries 35 Ok(None) => None, 36 Ok(Some(e)) => Some(Ok(e)), 37 Err(e) => Some(Err(e)), 38 } 39 } 40 }