Skip to main content

qubit_fs/traits/
directory_stream.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Directory listing stream trait.
11
12use std::fmt::Debug;
13
14use crate::{
15    DirEntry,
16    FsResult,
17};
18
19/// Stream of directory entries.
20pub trait DirectoryStream: Debug + Send {
21    /// Reads the next directory entry.
22    ///
23    /// # Returns
24    /// `Ok(Some(entry))` for an entry, `Ok(None)` at end of stream.
25    ///
26    /// # Errors
27    /// Returns [`crate::FsError`] when the provider cannot continue listing.
28    fn next_entry(&mut self) -> FsResult<Option<DirEntry>>;
29}