pub struct FilePicker {Show 13 fields
pub root: Option<PathBuf>,
pub path: Option<PathBuf>,
pub allowed_types: Vec<String>,
pub key_map: KeyMap,
pub show_permissions: bool,
pub show_size: bool,
pub show_hidden: bool,
pub dir_allowed: bool,
pub file_allowed: bool,
pub height: usize,
pub auto_height: bool,
pub cursor_char: String,
pub styles: Styles,
/* private fields */
}Expand description
File picker model for browsing and selecting files.
Fields§
§root: Option<PathBuf>Root directory (jail) for navigation.
path: Option<PathBuf>Currently selected path (after selection).
allowed_types: Vec<String>Allowed file extensions (empty = all allowed).
key_map: KeyMapKey bindings.
show_permissions: boolWhether to show permissions.
show_size: boolWhether to show file sizes.
Whether to show hidden files.
dir_allowed: boolWhether directories can be selected.
file_allowed: boolWhether files can be selected.
height: usizeHeight of the picker in rows.
auto_height: boolWhether to auto-adjust height based on window size.
cursor_char: StringCursor character.
styles: StylesStyles.
Implementations§
Source§impl FilePicker
impl FilePicker
Sourcepub fn current_directory(&self) -> &Path
pub fn current_directory(&self) -> &Path
Returns the current directory.
Sourcepub fn set_root(&mut self, root: impl AsRef<Path>)
pub fn set_root(&mut self, root: impl AsRef<Path>)
Sets the root directory (jail). Navigation above this directory will be blocked.
Sourcepub fn set_current_directory(&mut self, path: impl AsRef<Path>)
pub fn set_current_directory(&mut self, path: impl AsRef<Path>)
Sets the current directory.
Sourcepub fn set_height(&mut self, height: usize)
pub fn set_height(&mut self, height: usize)
Sets the height of the file picker.
Sourcepub fn set_allowed_types(&mut self, types: Vec<String>)
pub fn set_allowed_types(&mut self, types: Vec<String>)
Sets the allowed file types.
Sourcepub fn selected_path(&self) -> Option<&Path>
pub fn selected_path(&self) -> Option<&Path>
Returns the selected file path, if any.
Sourcepub fn highlighted_entry(&self) -> Option<&DirEntry>
pub fn highlighted_entry(&self) -> Option<&DirEntry>
Returns the currently highlighted entry, if any.
Sourcepub fn init(&self) -> Option<Cmd>
pub fn init(&self) -> Option<Cmd>
Initializes the file picker and returns a command to read the directory.
Sourcepub fn did_select_file(&self, msg: &Message) -> Option<PathBuf>
pub fn did_select_file(&self, msg: &Message) -> Option<PathBuf>
Checks if this message indicates a file was selected.
Sourcepub fn did_select_disabled_file(&self, msg: &Message) -> Option<PathBuf>
pub fn did_select_disabled_file(&self, msg: &Message) -> Option<PathBuf>
Checks if this message indicates a disabled file was selected.
Trait Implementations§
Source§impl Clone for FilePicker
impl Clone for FilePicker
Source§fn clone(&self) -> FilePicker
fn clone(&self) -> FilePicker
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more