pub struct TreeConfig {
pub root_path: PathBuf,
pub filter: DirectoryFilter,
pub max_depth: Option<u32>,
pub prefetch_per_parent: usize,
pub prefetch_skip: Vec<String>,
}Expand description
Per-tree configuration.
Constructed internally by DirectoryTree::new and its builder
methods; exposed as pub so tests and downstream tooling can
introspect the configuration.
Fields§
§root_path: PathBufThe tree’s root directory.
filter: DirectoryFilterActive display filter.
max_depth: Option<u32>Maximum depth to descend into. None = unbounded.
Depth is measured relative to the root: Some(0) means only
root’s direct children load, Some(1) allows grandchildren,
and so on.
prefetch_per_parent: usizev0.5 — parallel pre-expansion of visible descendants.
When a user-initiated expansion finishes loading a folder,
eagerly issue background scans for up to this many of the
folder’s direct children-that-are-folders, in parallel via
ScanExecutor. The scans populate the in-memory cache
(is_loaded = true) but do not automatically expand the
children in the UI — the user still controls what’s visible.
When they later click to expand one of those children, the
data is already there: no I/O, no thread spawn, no delay.
0 (the default) disables prefetch entirely, matching v0.1–0.4
behaviour exactly. Higher values improve perceived
responsiveness at the cost of background I/O on every
user-initiated expansion. Typical app values: 5–25. A huge
value just means “prefetch every child folder”; the crate
doesn’t cap it because apps with fast executors may legitimately
want that.
Prefetch is one level deep only — a folder that loaded via
prefetch does not itself trigger further prefetches of its
children. This is intentional: cascading prefetch is
exponential (per_parent ^ depth) and would be surprising as
a default. If you need deeper prefetch, issue further
DirectoryTreeEvent::Toggled
events yourself from your app’s update handler, or keep an
eye on a future release — deeper cascade behind an opt-in may
be added in a patch.
Prefetch respects max_depth the same way user-initiated
scans do: a prefetch target past the depth cap is skipped.
prefetch_skip: Vec<String>v0.6.1 — prefetch safety valve.
A list of basenames that DirectoryTree’s prefetch
machinery refuses to scan. Match is exact-basename, ASCII
case-insensitive: the entry "target" skips a folder
named target/ or Target/ but not my-target-files/.
Defaults to DEFAULT_PREFETCH_SKIP — a curated list of
common very-large directories (.git, node_modules,
target, …) that are rarely the thing a user is browsing
toward when they click around a tree. Apps can replace the
list entirely via with_prefetch_skip, or disable
skipping by passing an empty list.
Applies only to automatic prefetch scans. A user- initiated expansion (they clicked it) is never filtered — their click is an explicit request.
Trait Implementations§
Source§impl Clone for TreeConfig
impl Clone for TreeConfig
Source§fn clone(&self) -> TreeConfig
fn clone(&self) -> TreeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TreeConfig
impl RefUnwindSafe for TreeConfig
impl Send for TreeConfig
impl Sync for TreeConfig
impl Unpin for TreeConfig
impl UnsafeUnpin for TreeConfig
impl UnwindSafe for TreeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more