Struct RetainedFileExplorer

Source
pub struct RetainedFileExplorer<T, A = ()> { /* private fields */ }
Expand description

Filesystem explorer backed by a retained TreeModelHandle. Node metadata is resolved only for the row being interacted with; ordinary build, layout, paint, and scroll never reconstruct a recursive snapshot.

The inner tree is always virtualized and uses intent-only mutation mode. Callers own the authoritative model/store and apply emitted identity-aware events. Reserved create IDs must be unique and must remain valid until commit or the matching release callback.

§Examples

use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(
    model, |_| None, |_| None, |_parent, _kind| Some(1), |_id| {},
);
let _ = explorer;

Implementations§

Source§

impl<T, A> RetainedFileExplorer<T, A>
where T: Clone + Eq + Hash + Debug + 'static, A: 'static,

Source

pub fn new( model: TreeModelHandle<T>, resolve_node: impl Fn(T) -> Option<FileExplorerNode> + 'static, resolve_id: impl Fn(&FileUri) -> Option<T> + 'static, reserve_node: impl Fn(Option<&T>, FileKind) -> Option<T> + 'static, release_node: impl Fn(T) + 'static, ) -> Self

Creates a virtualized explorer over an authoritative retained model.

resolve_node supplies current URI/metadata for one ID, resolve_id maps context-menu URI commands back to identity, reserve_node allocates a transient file/directory draft ID, and release_node rolls it back on cancellation or invalid commit. Returning None rejects that operation.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u32>::new());
let explorer = RetainedFileExplorer::<u32, ()>::new(
    model, |_| None, |_| None, |_parent, _kind| Some(10), |_id| {},
);
let _ = explorer;
Source

pub fn selected(self, selected: impl Into<Binding<T>>) -> Self

Sets static/generic retained selection and clears writable selection state.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).selected(1);
let _ = explorer;
Source

pub fn bind_selected(self, selected: impl Into<Signal<T>>) -> Self

Binds selection to writable shared retained identity state.

§Examples
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).bind_selected(State::new(1));
let _ = explorer;
Source

pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self

Binds whether retained-tree interaction is disabled.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).disabled(true);
let _ = explorer;
Source

pub fn clipboard_can_paste(self, can_paste: impl Into<Binding<bool>>) -> Self

Binds keyboard and blank-menu paste eligibility.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).clipboard_can_paste(true);
let _ = explorer;
Source

pub fn file_style(self, style: FileExplorerStyle) -> Self

Replaces the complete retained tree style.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerStyle, RetainedFileExplorer};
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).file_style(FileExplorerStyle::default());
let _ = explorer;
Source

pub fn file_size(self, size: FileExplorerSize) -> Self

Applies a density preset under the default theme, replacing prior style.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerSize, RetainedFileExplorer};
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).file_size(FileExplorerSize::Compact);
let _ = explorer;
Source

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

Wraps the retained tree in a vertical scroll view when true.

Scrolling defaults to true; row virtualization remains enabled either way.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).scrollable(false);
let _ = explorer;
Source

pub fn tree_diagnostics(self, diagnostics: TreeViewDiagnostics) -> Self

Attaches permanent structural counters to the retained tree.

The handle is UI-local and does not affect model ownership or worker scheduling. It is intended for performance gates and diagnostics.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle, TreeViewDiagnostics};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let diagnostics = TreeViewDiagnostics::new();
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).tree_diagnostics(diagnostics.clone());
assert_eq!(diagnostics.snapshot().layout_calls, 0);
let _ = explorer;
Source

pub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self

Maps high-level URI actions into application actions.

Identity-aware model events are emitted separately and first where both representations exist.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerAction, RetainedFileExplorer};
enum Action { Explorer(FileExplorerAction) }
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, Action>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_action(Action::Explorer);
let _ = explorer;
Source

pub fn on_action_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static, ) -> Self

Handles high-level URI actions with event-context access.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_action_ctx(|_ctx, _action| {});
let _ = explorer;
Source

pub fn on_model_event( self, f: impl Fn(FileExplorerModelEvent<T>) -> A + 'static, ) -> Self

Maps identity-aware select/open/toggle/edit events into application actions.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerModelEvent, RetainedFileExplorer};
enum Action { Model(FileExplorerModelEvent<u64>) }
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, Action>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_model_event(Action::Model);
let _ = explorer;
Source

pub fn on_model_event_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerModelEvent<T>) + 'static, ) -> Self

Handles identity-aware events with direct event-context access.

§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_model_event_ctx(|_ctx, _event| {});
let _ = explorer;

Trait Implementations§

Source§

impl<T, A> IntoView<A> for RetainedFileExplorer<T, A>
where T: Clone + Eq + Hash + Debug + 'static, A: 'static,

Converts the retained adapter into a virtualized tree and context-menu view.

Source§

fn into_view(self) -> View<A>

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

impl<T, A> LayoutExt for RetainedFileExplorer<T, A>

Exposes standard layout mutation to generated extension/builders.

Source§

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

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

Auto Trait Implementations§

§

impl<T, A> Freeze for RetainedFileExplorer<T, A>
where T: Freeze,

§

impl<T, A = ()> !RefUnwindSafe for RetainedFileExplorer<T, A>

§

impl<T, A = ()> !Send for RetainedFileExplorer<T, A>

§

impl<T, A = ()> !Sync for RetainedFileExplorer<T, A>

§

impl<T, A> Unpin for RetainedFileExplorer<T, A>
where T: Unpin,

§

impl<T, A = ()> !UnwindSafe for RetainedFileExplorer<T, 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,