INNER CODE UNIT · Rust
new
mufeedvh/code2prompt · crates/code2prompt/src/model/mod.rs:53
pub fn new(path: std::path::PathBuf, level: usize) -> Self {
let name = path
.file_name()
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_else(|| path.to_string_lossy().to_string());
let is_directory = path.is_dir();
Self {
path,
name,
is_directory,
is_expanded: false,
level,
children_loaded: false,
children: Vec::new(),
}
}