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
//! Framework-free state machine for a lazy-loading directory-tree widget.
//!
//! This crate powers the `dioxus-swdir-tree` widget crate but depends on no UI framework
//! and no async runtime. It models a navigable tree of files and
//! directories over the [`swdir`] crate's single-level `scan_dir`
//! primitive, following the design documents of `iced-swdir-tree` v0.7.
//!
//! # Architecture
//!
//! State transitions are synchronous methods on [`DirectoryTree`]. They
//! never block on I/O and never spawn tasks; instead, transitions that
//! require disk access return a [`ScanRequest`] **as data**. The caller —
//! a Dioxus coroutine, a thread pool, or a test — executes the request
//! (see [`scan::run`]) off the UI thread and feeds the resulting
//! [`LoadPayload`] back through [`DirectoryTree::on_loaded`].
//!
//! Every scan is tagged with a wrapping `u32` generation. A result is
//! merged if and only if its generation strictly equals the tree's
//! current counter; anything else is stale and silently discarded. This
//! makes the widget safe against out-of-order delivery.
//!
//! # Quick start (blocking helper)
//!
//! ```no_run
//! use dioxus_swdir_tree_core::{DirectoryTree, DisplayFilter, SelectionMode};
//!
//! let mut tree = DirectoryTree::new("/some/project")
//! .with_filter(DisplayFilter::FilesAndFolders);
//!
//! // Synchronous convenience path (tests, scripts, examples):
//! tree.expand_blocking(&tree.config().root_path.clone());
//!
//! // Select the root:
//! tree.on_selected(&tree.config().root_path.clone(), true, SelectionMode::Replace);
//!
//! for (node, depth) in tree.visible_rows() {
//! println!("{:indent$}{}{}", "",
//! if node.is_selected { "* " } else { " " },
//! node.path.display(),
//! indent = depth as usize * 2);
//! }
//! ```
//!
//! In a GUI, use [`DirectoryTree::on_toggled`] / [`DirectoryTree::on_loaded`]
//! and run [`scan::run`] on a worker.
pub use ;
pub use ;
pub use LoadedEntry;
pub use ScanIssue;
pub use TreeNode;
pub use ;
pub use SelectionMode;
pub use DirectoryTree;
pub use ;