pub struct LocalFileExplorer<A = ()> { /* private fields */ }Expand description
File explorer that resolves a native root and owns a background local worker.
Paths may be absolute or relative to the process working directory/root. The
default uses lazy cached loading, virtualization, scrolling, retained watcher
updates, and enabled interaction. A is the application action type.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".");
let _ = explorer;Implementations§
Source§impl<A: 'static> LocalFileExplorer<A>
impl<A: 'static> LocalFileExplorer<A>
Sourcepub fn height(self, value: impl Into<Length>) -> Self
pub fn height(self, value: impl Into<Length>) -> Self
Sets preferred height from a logical-pixel or length value.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().height(40.0);
let _ = widget;Sourcepub fn min_width(self, value: impl Into<Length>) -> Self
pub fn min_width(self, value: impl Into<Length>) -> Self
Sets the minimum width bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().min_width(40.0);
let _ = widget;Sourcepub fn max_width(self, value: impl Into<Length>) -> Self
pub fn max_width(self, value: impl Into<Length>) -> Self
Sets the maximum width bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().max_width(320.0);
let _ = widget;Sourcepub fn min_height(self, value: impl Into<Length>) -> Self
pub fn min_height(self, value: impl Into<Length>) -> Self
Sets the minimum height bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().min_height(24.0);
let _ = widget;Sourcepub fn max_height(self, value: impl Into<Length>) -> Self
pub fn max_height(self, value: impl Into<Length>) -> Self
Sets the maximum height bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().max_height(240.0);
let _ = widget;Sourcepub fn fill(self) -> Self
pub fn fill(self) -> Self
Sets both preferred axes to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill();
let _ = widget;Sourcepub fn fill_width(self) -> Self
pub fn fill_width(self) -> Self
Sets preferred width to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill_width();
let _ = widget;Sourcepub fn fill_height(self) -> Self
pub fn fill_height(self) -> Self
Sets preferred height to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill_height();
let _ = widget;Sourcepub fn margin(self, value: f32) -> Self
pub fn margin(self, value: f32) -> Self
Sets uniform outer margin in logical pixels.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().margin(8.0);
let _ = widget;Sourcepub fn padding(self, value: f32) -> Self
pub fn padding(self, value: f32) -> Self
Sets uniform inner padding in logical pixels.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().padding(8.0);
let _ = widget;Sourcepub fn flex_grow(self) -> Self
pub fn flex_grow(self) -> Self
Sets flex-grow weight to one.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_grow();
let _ = widget;Sourcepub fn flex_grow_by(self, value: f32) -> Self
pub fn flex_grow_by(self, value: f32) -> Self
Sets a dimensionless flex-grow weight.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_grow_by(2.0);
let _ = widget;Sourcepub fn flex_shrink(self, value: f32) -> Self
pub fn flex_shrink(self, value: f32) -> Self
Sets a dimensionless flex-shrink weight.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_shrink(1.0);
let _ = widget;Sourcepub fn flex_basis(self, value: impl Into<Length>) -> Self
pub fn flex_basis(self, value: impl Into<Length>) -> Self
Sets the preferred main-axis flex basis.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_basis(80.0);
let _ = widget;Sourcepub fn align_self(self, value: AlignItems) -> Self
pub fn align_self(self, value: AlignItems) -> Self
Overrides cross-axis alignment for this flex item.
§Examples
use ailloli_ui_core::style::AlignItems;
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().align_self(AlignItems::Center);
let _ = widget;Source§impl<A: 'static> LocalFileExplorer<A>
impl<A: 'static> LocalFileExplorer<A>
Sourcepub fn new(root_path: impl Into<PathBuf>) -> Self
pub fn new(root_path: impl Into<PathBuf>) -> Self
Creates a local explorer rooted at an absolute working-directory path.
Relative paths are joined to the current directory, falling back to /
only if the current directory cannot be queried. The path is not
canonicalized and need not exist until the component begins loading.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new("src");
let _ = explorer;Sourcepub fn selected_path(self, path: impl Into<PathBuf>) -> Self
pub fn selected_path(self, path: impl Into<PathBuf>) -> Self
Sets the selected path used for row selection and ancestor reveal.
A relative path is joined to the explorer root; an absolute path is kept verbatim. The path is not canonicalized or required to exist.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").selected_path("src/lib.rs");
let _ = explorer;Sourcepub fn default_expanded_path(self, path: impl Into<PathBuf>) -> Self
pub fn default_expanded_path(self, path: impl Into<PathBuf>) -> Self
Appends one initially expanded path if not already present.
Relative resolution matches Self::selected_path. On build, every
root-to-path ancestor is also expanded; paths outside the root add none.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").default_expanded_path("src");
let _ = explorer;Sourcepub fn default_expanded_paths(
self,
paths: impl IntoIterator<Item = PathBuf>,
) -> Self
pub fn default_expanded_paths( self, paths: impl IntoIterator<Item = PathBuf>, ) -> Self
Replaces initial expansion paths, deduplicating while preserving order.
§Examples
use std::path::PathBuf;
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".")
.default_expanded_paths([PathBuf::from("src"), PathBuf::from("tests")]);
let _ = explorer;Sourcepub fn file_tree_options(self, options: FileTreeOptions) -> Self
pub fn file_tree_options(self, options: FileTreeOptions) -> Self
Replaces the complete provider-neutral filtering/loading policy snapshot.
This does not resynchronize LocalFileExplorerLoadingMode from
options.load_mode; call Self::load_mode or Self::local_loading_mode
afterward when both must agree.
§Examples
use ailloli_ui_widgets::files::{FileTreeOptions, LocalFileExplorer};
let options = FileTreeOptions { include_hidden: true, ..FileTreeOptions::default() };
let explorer = LocalFileExplorer::<()>::new(".").file_tree_options(options);
let _ = explorer;Sourcepub fn load_mode(self, load_mode: FileTreeLoadMode) -> Self
pub fn load_mode(self, load_mode: FileTreeLoadMode) -> Self
Sets provider-neutral load mode and maps it to a local runtime mode.
Lazy maps to LocalFileExplorerLoadingMode::LazyReload, not the
builder’s default lazy-cached behavior. This method does not change
LocalFileExplorerCacheMode.
§Examples
use ailloli_ui_widgets::files::{FileTreeLoadMode, LocalFileExplorer};
let explorer = LocalFileExplorer::<()>::new(".")
.load_mode(FileTreeLoadMode::Controlled { preload_depth: 2 });
let _ = explorer;Sourcepub fn lazy_loading(self) -> Self
pub fn lazy_loading(self) -> Self
Selects lazy reload-on-open loading via Self::load_mode.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").lazy_loading();
let _ = explorer;Sourcepub fn lazy_cached(self) -> Self
pub fn lazy_cached(self) -> Self
Selects lazy loading that reuses loaded directory state.
This synchronizes local mode, cache mode, and provider-neutral mode.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").lazy_cached();
let _ = explorer;Sourcepub fn controlled_loading(self, preload_depth: usize) -> Self
pub fn controlled_loading(self, preload_depth: usize) -> Self
Proactively loads through the inclusive directory preload_depth.
Depth zero includes the root request but not its child directories.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").controlled_loading(1);
let _ = explorer;Sourcepub fn full_load(self) -> Self
pub fn full_load(self) -> Self
Proactively loads directories through the configured maximum depth.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").max_depth(4).full_load();
let _ = explorer;Sourcepub fn local_loading_mode(self, mode: LocalFileExplorerLoadingMode) -> Self
pub fn local_loading_mode(self, mode: LocalFileExplorerLoadingMode) -> Self
Sets the local strategy and synchronizes provider-neutral load mode.
Both lazy variants map to FileTreeLoadMode::Lazy. Cache mode remains
independent, so use Self::cache_mode when a specific toggle policy is
required.
§Examples
use ailloli_ui_widgets::files::{LocalFileExplorer, LocalFileExplorerLoadingMode};
let explorer = LocalFileExplorer::<()>::new(".")
.local_loading_mode(LocalFileExplorerLoadingMode::FullLoad);
let _ = explorer;Sourcepub fn cache_mode(self, mode: LocalFileExplorerCacheMode) -> Self
pub fn cache_mode(self, mode: LocalFileExplorerCacheMode) -> Self
Sets toggle-driven reload/cache behavior independently of load depth.
§Examples
use ailloli_ui_widgets::files::{LocalFileExplorer, LocalFileExplorerCacheMode};
let explorer = LocalFileExplorer::<()>::new(".")
.cache_mode(LocalFileExplorerCacheMode::LoadOnceSnapshot);
let _ = explorer;Sourcepub fn virtualized(self, virtualized: bool) -> Self
pub fn virtualized(self, virtualized: bool) -> Self
Enables or disables visible-row virtualization in the inner explorer.
Virtualization is enabled by default and changes rendering cost, not the retained filesystem tree or callback semantics.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").virtualized(false);
let _ = explorer;Sourcepub fn scrollable(self, scrollable: bool) -> Self
pub fn scrollable(self, scrollable: bool) -> Self
Enables or disables the inner explorer’s scroll viewport.
Disabling scrolling does not disable virtualization automatically.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").scrollable(false);
let _ = explorer;Sourcepub fn async_loading(self, async_loading: bool) -> Self
pub fn async_loading(self, async_loading: bool) -> Self
Retains the legacy asynchronous-loading preference.
The current retained local implementation always uses its background
[FileTreeRuntime]; this compatibility flag has no behavioral effect.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").async_loading(true);
let _ = explorer;Includes dot-prefixed entries when true.
A selected hidden entry and its ancestors remain visible when
Self::reveal_selected is enabled, even when this is false.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").include_hidden(true);
let _ = explorer;Sourcepub fn max_depth(self, max_depth: usize) -> Self
pub fn max_depth(self, max_depth: usize) -> Self
Sets the hard recursion/preload depth; root is depth zero.
Zero permits loading the root listing but not descending into child directories in the synchronous snapshot helper.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").max_depth(3);
let _ = explorer;Sourcepub fn reveal_selected(self, reveal_selected: bool) -> Self
pub fn reveal_selected(self, reveal_selected: bool) -> Self
Controls whether selected ancestors bypass filters and load lazily.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").reveal_selected(false);
let _ = explorer;Sourcepub fn exclude_defaults(self, exclude_defaults: bool) -> Self
pub fn exclude_defaults(self, exclude_defaults: bool) -> Self
Excludes the fixed common heavy/generated directory set when true.
Selected ancestors still survive when reveal-selected is enabled.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").exclude_defaults(true);
let _ = explorer;Sourcepub fn max_entries_per_directory(self, max_entries: usize) -> Self
pub fn max_entries_per_directory(self, max_entries: usize) -> Self
Sets a per-directory retained entry cap, including zero.
The retained local runtime truncates whenever this is Some and adds a
placeholder. The synchronous local_file_tree_nodes helper additionally
follows FileTreeOptions::large_directory_policy. Replace the complete
options with None to clear an earlier cap.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").max_entries_per_directory(500);
let _ = explorer;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Binds whether inner explorer interaction is disabled.
Disabled state affects row actions but does not stop background loads, watches, or model refreshes.
§Examples
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").disabled(State::new(true));
let _ = explorer;Sourcepub fn file_style(self, style: FileExplorerStyle) -> Self
pub fn file_style(self, style: FileExplorerStyle) -> Self
Replaces the complete inner explorer style.
§Examples
use ailloli_ui_widgets::files::{FileExplorerStyle, LocalFileExplorer};
let explorer = LocalFileExplorer::<()>::new(".").file_style(FileExplorerStyle::default());
let _ = explorer;Sourcepub fn file_size(self, size: FileExplorerSize) -> Self
pub fn file_size(self, size: FileExplorerSize) -> Self
Applies a size preset using the default theme.
This replaces the entire prior style; call it before Self::file_style
when combining a preset with custom colors.
§Examples
use ailloli_ui_widgets::files::{FileExplorerSize, LocalFileExplorer};
let explorer = LocalFileExplorer::<()>::new(".").file_size(FileExplorerSize::Compact);
let _ = explorer;Sourcepub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self
pub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self
Maps every inner explorer action into an application action.
Specialized select/open callbacks may also run for the same interaction.
§Examples
use ailloli_ui_widgets::files::{FileExplorerAction, LocalFileExplorer};
enum Action { Explorer(FileExplorerAction) }
let explorer = LocalFileExplorer::<Action>::new(".").on_action(Action::Explorer);
let _ = explorer;Sourcepub fn on_action_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static,
) -> Self
pub fn on_action_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static, ) -> Self
Handles every inner explorer action with event-context access.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").on_action_ctx(|_ctx, _action| {});
let _ = explorer;Sourcepub fn on_select(self, f: impl Fn(FileUri) -> A + 'static) -> Self
pub fn on_select(self, f: impl Fn(FileUri) -> A + 'static) -> Self
Maps a row-selection URI into an application action.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::LocalFileExplorer;
enum Action { Select(FileUri) }
let explorer = LocalFileExplorer::<Action>::new(".").on_select(Action::Select);
let _ = explorer;Sourcepub fn on_select_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileUri) + 'static,
) -> Self
pub fn on_select_ctx( self, f: impl Fn(&mut EventCtx<A>, FileUri) + 'static, ) -> Self
Handles selection with direct event-context access.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").on_select_ctx(|_ctx, _uri| {});
let _ = explorer;Sourcepub fn on_open(self, f: impl Fn(FileUri) -> A + 'static) -> Self
pub fn on_open(self, f: impl Fn(FileUri) -> A + 'static) -> Self
Maps a leaf open/activation URI into an application action.
Directory toggle events are not open callbacks.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::LocalFileExplorer;
enum Action { Open(FileUri) }
let explorer = LocalFileExplorer::<Action>::new(".").on_open(Action::Open);
let _ = explorer;Sourcepub fn on_open_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileUri) + 'static,
) -> Self
pub fn on_open_ctx( self, f: impl Fn(&mut EventCtx<A>, FileUri) + 'static, ) -> Self
Handles leaf opening with direct event-context access.
§Examples
use ailloli_ui_widgets::files::LocalFileExplorer;
let explorer = LocalFileExplorer::<()>::new(".").on_open_ctx(|_ctx, _uri| {});
let _ = explorer;Trait Implementations§
Source§impl<A: 'static> IntoView<A> for LocalFileExplorer<A>
Converts builder inputs into a retained runtime-backed explorer component.
impl<A: 'static> IntoView<A> for LocalFileExplorer<A>
Converts builder inputs into a retained runtime-backed explorer component.