pub struct FilePicker { /* private fields */ }Expand description
Browse from a root and pick a path. Returns the path, joined to the
root as given (a root of . gives paths relative to it).
Implementations§
Source§impl FilePicker
impl FilePicker
pub fn new(prompt: impl Into<String>, root: impl Into<PathBuf>) -> FilePicker
Sourcepub fn extensions<I: IntoIterator<Item = S>, S: AsRef<str>>(
self,
extensions: I,
) -> Self
pub fn extensions<I: IntoIterator<Item = S>, S: AsRef<str>>( self, extensions: I, ) -> Self
List only files with one of these extensions (without the dot, any case); directories are still listed, to open.
Show hidden files (names starting with .) to begin with; Ctrl+T
toggles them.
Sourcepub fn jail(self, on: bool) -> Self
pub fn jail(self, on: bool) -> Self
Keep to the root: nothing outside it is listed, opened or read, and symbolic links out of it are left out. A root that cannot be resolved lists nothing.
Sourcepub fn default(self, path: impl Into<PathBuf>) -> Self
pub fn default(self, path: impl Into<PathBuf>) -> Self
The path returned without a terminal when the policy asks for defaults.
pub fn preview(self, layout: PreviewLayout) -> Self
Sourcepub fn rebind(self, action: &str, keys: impl IntoIterator<Item = Key>) -> Self
pub fn rebind(self, action: &str, keys: impl IntoIterator<Item = Key>) -> Self
Make keys do action on this picker only; no keys unbinds it.
The actions are the picker’s own (open, up, hidden, in context
file) and its list’s (see select_keymap).
A name both have means the picker’s: up is going to the parent
directory, not the cursor. Write select.up for the list’s (and
file.up, if you like, for the picker’s).
pub fn theme(self, theme: Theme) -> Self
The key that opens the action menu (default Ctrl+K).
Sourcepub fn with_mouse(self, on: bool) -> Self
pub fn with_mouse(self, on: bool) -> Self
Report the mouse: a click focuses, a second click opens or picks, and the border beside the preview drags.
Trait Implementations§
Source§impl Component for FilePicker
impl Component for FilePicker
type Output = PathBuf
Source§fn handle(&mut self, event: &Event, context: &Context<'_>) -> Flow<PathBuf>
fn handle(&mut self, event: &Event, context: &Context<'_>) -> Flow<PathBuf>
Outcome::Interrupted.Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
keymap). A container’s include its focused
child’s, before its own. The default declares none.Source§fn mouse(&self) -> bool
fn mouse(&self) -> bool
run then enables mouse reporting
for the session.Source§fn tick(&self) -> Option<Duration>
fn tick(&self) -> Option<Duration>
Event::Tick, for a spinner or a
countdown. None (the default): never.Source§fn default_value(&self) -> Option<PathBuf>
fn default_value(&self) -> Option<PathBuf>
None: there is none.Source§fn prompt(
&mut self,
_: &mut dyn LineIo,
) -> Result<Option<PathBuf>, NotInteractive>
fn prompt( &mut self, _: &mut dyn LineIo, ) -> Result<Option<PathBuf>, NotInteractive>
Source§fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
Done or Cancel finishes the component
without waiting for an event. The default does nothing.Source§fn focusable(&self) -> bool
fn focusable(&self) -> bool
Source§fn focus_step(&mut self, forward: bool) -> bool
fn focus_step(&mut self, forward: bool) -> bool
forward) or previous focus stop inside
this component, for Tab and Shift+Tab. false when there is none
after the current one, so the container moves on to its next
child. The default, for a component that is one stop: false.Auto Trait Implementations§
impl !Freeze for FilePicker
impl !RefUnwindSafe for FilePicker
impl !Sync for FilePicker
impl !UnwindSafe for FilePicker
impl Send for FilePicker
impl Unpin for FilePicker
impl UnsafeUnpin for FilePicker
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<C> ComponentExt for Cwhere
C: Component,
impl<C> ComponentExt for Cwhere
C: Component,
Source§fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
M’s flow: Flow::Done(m) to
finish the whole composition with m, Flow::Continue to carry on
(the component stays, showing its answer, and focus moves past it).
Cancelling cancels the composition unless
on_cancel says otherwise.