Struct LocalFileExplorer

Source
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>

Source

pub fn width(self, value: impl Into<Length>) -> Self

Sets preferred width from a logical-pixel or length value.

§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().width(120.0);
let _ = widget;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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>

Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

pub fn include_hidden(self, include_hidden: bool) -> Self

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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;
Source

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.

Source§

fn into_view(self) -> View<A>

Consumes a builder/value and returns its declarative view tree. Read more
Source§

impl<A: 'static> LayoutExt for LocalFileExplorer<A>

Source§

fn layout_mut(&mut self) -> &mut LayoutStyle

Returns the widget’s mutable declarative size/inset state. Read more

Auto Trait Implementations§

§

impl<A> Freeze for LocalFileExplorer<A>

§

impl<A = ()> !RefUnwindSafe for LocalFileExplorer<A>

§

impl<A = ()> !Send for LocalFileExplorer<A>

§

impl<A = ()> !Sync for LocalFileExplorer<A>

§

impl<A> Unpin for LocalFileExplorer<A>

§

impl<A = ()> !UnwindSafe for LocalFileExplorer<A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, A> FlexItemExt<A> for T
where T: IntoView<A>,

Source§

fn flex_grow(self) -> View<A>

Sets flex-grow weight to one. Read more
Source§

fn flex_grow_by(self, value: f32) -> View<A>

Sets the dimensionless flex-grow weight. Read more
Source§

fn flex_shrink(self, value: f32) -> View<A>

Sets the dimensionless flex-shrink weight. Read more
Source§

fn flex_basis(self, value: impl Into<Length>) -> View<A>

Sets the preferred main-axis flex basis. Read more
Source§

fn align_self(self, value: AlignItems) -> View<A>

Overrides the parent cross-axis alignment for this view. Read more
Source§

fn fill_width(self) -> View<A>

Marks width as parent-fill in the view size hint. Read more
Source§

fn fill_height(self) -> View<A>

Marks height as parent-fill in the view size hint. Read more
Source§

fn fill(self) -> View<A>

Marks both axes as parent-fill in the view size hint. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, A> IntoViewKeyExt<A> for T
where T: IntoView<A>,

§

fn key(self, key: impl Into<String>) -> View<A>

Converts self, assigns the owned key, and returns the view. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,