ratatui_toolkit/widgets/file_system_tree/constructors/with_config.rs
1use anyhow::Result;
2use std::path::PathBuf;
3
4use crate::widgets::file_system_tree::{FileSystemTree, FileSystemTreeConfig};
5
6impl<'a> FileSystemTree<'a> {
7 pub fn with_config(root_path: PathBuf, config: FileSystemTreeConfig) -> Result<Self> {
8 let nodes = Self::load_directory(&root_path, &config)?;
9
10 Ok(Self {
11 root_path,
12 nodes,
13 config,
14 block: None,
15 })
16 }
17}