pub fn create(
        root: Option<PathBuf>,
        init: Option<PathBuf>,
        file_regex: Option<Regex>,
    ) -> io::Result<FileView> {
        let cur_dir = env::current_dir()?;
        let root_path = root.unwrap_or_else(|| cur_dir).canonicalize()?;
        let init_path = init.unwrap_or_else(|| root_path.clone()).canonicalize()?;
        let view_name = rand::thread_rng()
            .sample_iter(&Alphanumeric)
            .take(10)
            .collect::<String>();
        let mut fv = FileView {
            root_path,
            init_path,
            file_regex,
            view: TreeView::new(),
            view_name,
        };
        fv.init_view()?;
        fv.set_on_collapse();
        Ok(fv)
    }
/// Creates a new FileView, with a base directory and an initial target.
///
/// By default the base is the current directory, and the initial targe is the base.
/// By default there is no regular expression to filter which files are shown and can be submitted.
///
/// # Example
///
/// ```rust
/// # extern crate cursive;
/// # extern crate cursive_tree_view;
/// # use cursive::Cursive;
/// # use cursive_tree_view::FileView;
/// # fn main() {
/// let mut fileview = FileView::new();
/// # }
/// ```
Creates a new FileView, with a base directory and an initial target.
By default the base is the current directory, and the initial targe is the base.
By default there is no regular expression to filter which files are shown and can be submitted.
Creates a new FileView with a base directory and an initial target . By default the base is the current directory and the initial targe is the base . By default there is no regular expression to filter which files are shown and can be submitted .
pub fn create(
        root: Option<PathBuf>,
        init: Option<PathBuf>,
        file_regex: Option<Regex>,
    ) -> io::Result<FileView> {
        let cur_dir = env::current_dir()?;
        let root_path = root.unwrap_or_else(|| cur_dir).canonicalize()?;
        let init_path = init.unwrap_or_else(|| root_path.clone()).canonicalize()?;
        let view_name = rand::thread_rng()
            .sample_iter(&Alphanumeric)
            .take(10)
            .collect::<String>();
        let mut fv = FileView {
            root_path,
            init_path,
            file_regex,
            view: TreeView::new(),
            view_name,
        };
        fv.init_view()?;
        fv.set_on_collapse();
        Ok(fv)
    }
pub fn create ( root : Option < PathBuf > , init : Option < PathBuf > , file_regex : Option < Regex > , ) -> io :: Result < FileView > { let cur_dir = env :: current_dir ( ) ? ; let root_path = root . unwrap_or_else ( | | cur_dir ) . canonicalize ( ) ? ; let init_path = init . unwrap_or_else ( | | root_path . clone ( ) ) . canonicalize ( ) ? ; let view_name = rand :: thread_rng ( ) . sample_iter ( & Alphanumeric ) . take ( 10 ) . collect :: < String > ( ) ; let mut fv = FileView { root_path , init_path , file_regex , view : TreeView :: new ( ) , view_name , } ; fv . init_view ( ) ? ; fv . set_on_collapse ( ) ; Ok ( fv ) }
Creates a new FileView, with a base directory and an initial target.
Creates a new FileView with a base directory and an initial target .
root
Option<PathBuf>
init
Option<PathBuf>
file_regex
Option<Regex>
root
Option<PathBuf>
init
Option<PathBuf>
file_regex
Option<Regex>
example
None
extern crate cursive;
None
extern crate cursive_tree_view;
None
use cursive::cursive;
None
use cursive_tree_view::fileview;
None
fn main() {
let mut fileview = FileView::new().
let mut fileview = FileView :: new () .
}
None