### pub fn default() -> FilePicker Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePicker.html Creates a new FilePicker with default settings. ```APIDOC ### pub fn default() -> FilePicker #### Description Returns the default value for the FilePicker struct. #### Returns - **FilePicker** - A new instance of FilePicker with default values. ``` -------------------------------- ### Entry::from_path Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.Entry.html Creates a new Entry instance from a given file system path. ```APIDOC ## pub fn from_path(path: &Path) -> Option ### Description Creates an Entry from the provided path. Returns None if the entry cannot be created. ### Parameters - **path** (&Path) - Required - The file system path to convert into an Entry. ``` -------------------------------- ### TreeViewState::build_tree_entries Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.TreeViewState.html Builds a flat list of tree entries by walking the directory structure based on the current expansion state. ```APIDOC ## pub fn build_tree_entries(&self, root: &Path, show_hidden: bool, filter: Option<&dyn Fn(&Path) -> bool>) -> Vec ### Description Generates a flat list of TreeEntry objects by traversing the directory tree starting from the root, respecting the current expansion state, hidden file visibility, and an optional filter function. ``` -------------------------------- ### ListViewState::new Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.ListViewState.html Creates a new instance of ListViewState with default values. ```APIDOC ### pub fn new() -> Self Creates a new `ListViewState` instance with default cursor and scroll offset values. ``` -------------------------------- ### pub fn block(self, block: Block<'static>) -> Self Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePicker.html Configures the block for the FilePicker widget. ```APIDOC ### pub fn block(self, block: Block<'static>) -> Self #### Description Sets the block configuration for the FilePicker widget. #### Parameters - **block** (Block<'static>) - Required - The block to be applied to the widget. #### Returns - **Self** - The updated FilePicker instance. ``` -------------------------------- ### TreeViewState::new Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.TreeViewState.html Creates a new instance of TreeViewState with default values. ```APIDOC ## pub fn new() -> Self ### Description Creates a new instance of TreeViewState with default values for cursor, scroll_offset, and an empty set of expanded paths. ``` -------------------------------- ### pub fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePicker.html Renders the FilePicker widget into the provided buffer. ```APIDOC ### pub fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) #### Description Draws the current state of the FilePicker widget in the given buffer. #### Parameters - **area** (Rect) - Required - The area where the widget should be rendered. - **buf** (&mut Buffer) - Required - The buffer to draw into. - **state** (&mut Self::State) - Required - The state associated with the widget. ``` -------------------------------- ### FilePickerBuilder Methods Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePickerBuilder.html Methods available on the FilePickerBuilder to configure the file picker instance. ```APIDOC ## pub fn start_dir(self, dir: impl Into) -> Self Sets the initial directory for the file picker. ## pub fn mode(self, mode: PickerMode) -> Self Sets the selection mode for the file picker. ## pub fn view(self, view_mode: ViewMode) -> Self Sets the view mode for the file picker. ## pub fn filter(self, f: impl Fn(&Path) -> bool + 'static) -> Self Sets a filter function to determine which files are displayed. ## pub fn theme(self, theme: FilePickerTheme) -> Self Sets the visual theme for the file picker. ## pub fn show_hidden(self, show: bool) -> Self Configures whether hidden files should be displayed. ## pub fn build(self) -> FilePickerState Consumes the builder and returns the configured FilePickerState. ``` -------------------------------- ### Define the Entry struct Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.Entry.html The structure definition for Entry, containing the name, path, kind, and hidden status. ```rust pub struct Entry { pub name: String, pub path: PathBuf, pub kind: EntryKind, pub is_hidden: bool, } ``` -------------------------------- ### TreeViewState::toggle_expand Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.TreeViewState.html Toggles the expansion state of a directory at the given path. ```APIDOC ## pub fn toggle_expand(&mut self, path: &Path) ### Description Toggles the expansion state of the directory at the specified path. If the path is currently expanded, it will be collapsed; otherwise, it will be expanded. ``` -------------------------------- ### ListViewState Struct Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.ListViewState.html The core data structure containing the cursor index and scroll offset. ```rust pub struct ListViewState { pub cursor: usize, pub scroll_offset: usize, } ``` -------------------------------- ### Define FilePickerTheme struct Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePickerTheme.html The structure definition for FilePickerTheme, containing various Style fields for UI customization. ```rust pub struct FilePickerTheme { pub normal: Style, pub cursor: Style, pub selected: Style, pub directory: Style, pub symlink: Style, pub path_bar: Style, pub status_bar: Style, pub search_input: Style, pub error: Style, } ``` -------------------------------- ### ViewState::toggle Source: https://docs.rs/ratatree/0.1.0/ratatree/view/enum.ViewState.html Toggles the current view state between List and Tree variants. ```APIDOC ## pub fn toggle(self) -> Self ### Description Switches the current ViewState to the alternative variant. ### Signature `pub fn toggle(self) -> Self` ``` -------------------------------- ### FilePicker Struct Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePicker.html The definition of the FilePicker struct. ```rust pub struct FilePicker { /* private fields */ } ``` -------------------------------- ### FilePickerState Struct Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/struct.FilePickerState.html The primary structure containing the common and view states for the file picker. ```rust pub struct FilePickerState { pub common: CommonState, pub view: ViewState, } ``` -------------------------------- ### Define PickerResult Enum Source: https://docs.rs/ratatree/0.1.0/ratatree/enum.PickerResult.html The structure of the PickerResult enum, which tracks the state of a file or path selection. ```rust pub enum PickerResult { Pending, Selected(Vec), Cancelled, } ``` -------------------------------- ### EntryKind Enum Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/enum.EntryKind.html The core definition of the EntryKind enum, which categorizes filesystem objects. ```rust pub enum EntryKind { File, Directory, Symlink, } ``` -------------------------------- ### TreeViewState Struct Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.TreeViewState.html The core data structure used to maintain the state of a tree view. ```rust pub struct TreeViewState { pub cursor: usize, pub scroll_offset: usize, pub expanded: HashSet, } ``` -------------------------------- ### TreeViewState::is_expanded Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.TreeViewState.html Checks if a directory at the given path is currently expanded. ```APIDOC ## pub fn is_expanded(&self, path: &Path) -> bool ### Description Returns true if the directory at the specified path is currently expanded, false otherwise. ``` -------------------------------- ### ViewState::cursor Source: https://docs.rs/ratatree/0.1.0/ratatree/view/enum.ViewState.html Retrieves or modifies the cursor position within the current view state. ```APIDOC ## pub fn cursor(&self) -> usize ## pub fn cursor_mut(&mut self) -> &mut usize ### Description Provides access to the cursor position index for the current view state. ### Signature `pub fn cursor(&self) -> usize` `pub fn cursor_mut(&mut self) -> &mut usize` ``` -------------------------------- ### InputMode Enum Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/enum.InputMode.html The definition of the InputMode enum with its available variants. ```rust pub enum InputMode { Normal, Search, } ``` -------------------------------- ### ListViewState::visible_range Source: https://docs.rs/ratatree/0.1.0/ratatree/view/struct.ListViewState.html Calculates the range of visible items based on the total number of items and the available height. ```APIDOC ### pub fn visible_range(&self, total: usize, height: usize) -> Range Returns the visible range of entries for the current scroll state. #### Parameters - **total** (usize) - The total number of items in the list. - **height** (usize) - The height of the view area. ``` -------------------------------- ### ViewMode Enum Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/enum.ViewMode.html The core definition of the ViewMode enum with its two variants. ```rust pub enum ViewMode { List, Tree, } ``` -------------------------------- ### ViewState::scroll_offset Source: https://docs.rs/ratatree/0.1.0/ratatree/view/enum.ViewState.html Retrieves or modifies the scroll offset for the current view state. ```APIDOC ## pub fn scroll_offset(&self) -> usize ## pub fn scroll_offset_mut(&mut self) -> &mut usize ### Description Provides access to the scroll offset value for the current view state. ### Signature `pub fn scroll_offset(&self) -> usize` `pub fn scroll_offset_mut(&mut self) -> &mut usize` ``` -------------------------------- ### Define ViewState Enum Source: https://docs.rs/ratatree/0.1.0/ratatree/view/enum.ViewState.html The structure of the ViewState enum, which encapsulates either a List or a Tree view state. ```rust pub enum ViewState { List(ListViewState), Tree(TreeViewState), } ``` -------------------------------- ### TreeEntry Struct Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/view/tree/struct.TreeEntry.html The definition of the TreeEntry struct, which holds an entry and its depth level. ```rust pub struct TreeEntry { pub entry: Entry, pub depth: usize, } ``` -------------------------------- ### PickerMode Enum Definition Source: https://docs.rs/ratatree/0.1.0/ratatree/enum.PickerMode.html The core definition of the PickerMode enum used to specify selection behavior. ```rust pub enum PickerMode { FilesOnly, DirsOnly, Both, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.