dioxus-swdir-tree-core
Framework-free state machines powering dioxus-swdir-tree: a lazy-loading directory-tree explorer and a generic in-memory item-tree, both over swdir.
This crate depends only on swdir — no Dioxus, no async runtime — so it is testable anywhere and reusable from other frontends.
What's inside
DirectoryTree
- Lazy one-level loading —
on_toggledreturnsScanRequestas data;on_loadedmerges the result. - Stale-result protection via wrapping generation counter.
DisplayFilter/TreeCache— zero-I/O filter switching.SelectionMode(Replace / Toggle / ExtendRange) — insertion-ordered multi-selection.handle_key— read-only keyboard navigation overvisible_rows().on_drag_msg/DragMsg/DragOutcome— press → hover → release drag protocol; emitsCompleted { sources, destination }.- Speculative prefetch —
with_prefetch_limit,DEFAULT_PREFETCH_SKIP. set_search_query/SearchState— incremental basename search, zero I/O.IconTheme/IconRole/UnicodeTheme— pluggable icon rendering;LucideThemebehind theiconsfeature.
ItemTree<T>
- Fully preloaded in-memory tree over caller-supplied
NodeId-keyed data. No I/O, no generation counter. set_tree(root: ItemNode<T>)— key-based diffing preserves expansion and selection for survivingNodeIds (S11.4/S11.5).with_display(fn)— display function for search andVisibleItem::label.on_drag_msg/ItemDragMsg/ItemDragOutcome— three-position drag:DropPosition { Before, Into, After }.handle_key,set_search_query, selection — same contract asDirectoryTree.with_drag_and_drop(true)— opt-in; off by default.
License: Apache-2.0.