fast-fs 0.2.1

High-speed async file system traversal library with batteries-included file browser component
Documentation
// <FILE>crates/fast-fs/src/nav/fnc_browser_flat.rs</FILE> - <DESC>Flat-mode directory loader for Browser</DESC>
// <VERS>VERSION: 0.1.0</VERS>
// <WCTX>Adding bounded recursive walk (flat mode) to Browser</WCTX>
// <CLOG>Initial creation: load entries recursively for flat-mode browsing</CLOG>

//! Flat-mode directory loader
//!
//! In flat mode, a `Browser` displays all descendants of `current_path` as a
//! single flat list instead of just the current directory. This module wraps
//! `read_dir_recursive` to produce that list using the browser's existing
//! traversal options.
//!
//! The loader intentionally mirrors the traversal behaviour that `load_directory`
//! would apply (hidden files, gitignore) so the built-in filter pipeline
//! continues to work unchanged.

use crate::{read_dir_recursive, FileEntry, TraversalOptions};
use crate::nav::nav_error::NavError;
use std::path::Path;

/// Load a flat list of entries rooted at `path`, bounded by `depth`.
///
/// * `depth == None` — unlimited recursion.
/// * `depth == Some(n)` — at most `n` levels below `path` (so `Some(0)` is
///   equivalent to a non-recursive listing).
///
/// `include_hidden` mirrors `BrowserConfig::show_hidden`; `respect_ignore_files`
/// mirrors the equivalent config knob. Directories are included in the output
/// so downstream rendering can distinguish them, but the consumer is expected
/// to treat the listing as flat (no `cd` into children).
pub async fn load_flat_entries(
    path: &Path,
    depth: Option<usize>,
    include_hidden: bool,
    respect_ignore_files: bool,
) -> Result<Vec<FileEntry>, NavError> {
    let options = TraversalOptions {
        gitignore: respect_ignore_files,
        include_hidden,
        max_depth: depth,
        ..TraversalOptions::default()
    };

    let entries = read_dir_recursive(path, options).await?;
    Ok(entries)
}

// <FILE>crates/fast-fs/src/nav/fnc_browser_flat.rs</FILE>
// <VERS>END OF VERSION: 0.1.0</VERS>