1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// <FILE>crates/fast-fs/src/nav/mod.rs</FILE> - <DESC>Navigation module entry point</DESC>
// <VERS>VERSION: 0.6.0</VERS>
// <WCTX>Adding flat-mode, custom filter, and multi-root support to Browser</WCTX>
// <CLOG>Registered fnc_browser_flat and fnc_browser_virtual_root helper modules</CLOG>
//! Navigation module for file browsing
//!
//! This module provides a batteries-included library for embedding file browsing
//! into applications. It's designed for:
//!
//! - Save/Open dialogs
//! - Project explorers
//! - Asset browsers
//! - Config/log file pickers
//!
//! # Architecture
//!
//! The nav module is an **async state machine** that:
//! - Takes keyboard input via `KeyInput`
//! - Maps keys to actions via `KeyMap`
//! - Returns `ActionResult` to drive UI flow
//! - Uses async I/O for non-blocking directory reads
//!
//! The consumer (your UI framework) is responsible for:
//! - Rendering the browser state
//! - Converting framework events to `KeyInput`
//! - Handling confirmations and input dialogs
//! - Running in a tokio async runtime
//!
//! # Quick Start
//!
//! ```no_run
//! use fast_fs::nav::{Browser, BrowserConfig, KeyInput, ActionResult};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let config = BrowserConfig::open_dialog();
//! let mut browser = Browser::new(config).await?;
//!
//! // In your event loop:
//! let result = browser.handle_key(KeyInput::Down).await;
//! match result {
//! ActionResult::Done => { /* re-render */ }
//! ActionResult::DirectoryChanged => { /* full re-render */ }
//! ActionResult::NeedsConfirmation(op) => { /* show confirm dialog */ }
//! ActionResult::NeedsInput(req) => { /* show input dialog */ }
//! ActionResult::FileSelected(path) => { /* user selected a file */ }
//! ActionResult::Clipboard(state) => { /* store for paste */ }
//! ActionResult::Unhandled => { /* try jump_to_char */ }
//! }
//! Ok(())
//! }
//! ```
// Core types
// Re-export public types
pub use Action;
pub use ;
pub use BrowserConfig;
pub use ;
pub use ;
pub use KeyMap;
pub use Selection;
pub use FileCategory;
pub use validate_name;
pub use KeyInput;
pub use NavError;
// <FILE>crates/fast-fs/src/nav/mod.rs</FILE>
// <VERS>END OF VERSION: 0.6.0</VERS>