pub struct FileNode {
pub name: String,
pub path: String,
pub is_directory: bool,
pub children: Vec<FileNode>,
pub expanded: bool,
}Expand description
A node in the file tree representing a file or directory.
Fields§
§name: StringName of the file or directory (not full path).
path: StringFull path from VFS root.
is_directory: boolTrue if this is a directory.
children: Vec<FileNode>Child nodes (empty for files).
expanded: boolWhether this directory is expanded in the UI.
Implementations§
Source§impl FileNode
impl FileNode
Sourcepub fn from_paths<'a>(paths: impl IntoIterator<Item = &'a str>) -> Self
pub fn from_paths<'a>(paths: impl IntoIterator<Item = &'a str>) -> Self
The tree of the files at paths (VFS paths), each under its folders and every level in the
file browser’s order: the tree the Studio loads from a file system that holds exactly these
files.
Sourcepub fn sort_children(&mut self)
pub fn sort_children(&mut self)
Put this directory’s entries in the order the file browser shows them: directories first; the Studio’s code categories in learning order (basics first, projects last), everything else alphabetically. Unknown directory names rank after the curated set, so a future category still appears without touching this list.
Sourcepub fn with_expansion_of(self, shown: &FileNode) -> Self
pub fn with_expansion_of(self, shown: &FileNode) -> Self
This tree with each folder open or closed as shown has it, wherever shown has the same
folder: a tree loaded again keeps the reader’s choices, and a folder new to it starts open.
Sourcepub fn first_file_under(&self, dir: &str) -> Option<&str>
pub fn first_file_under(&self, dir: &str) -> Option<&str>
The first file under the directory at dir, in the order the tree shows it.
Sourcepub fn toggle_expanded(&mut self)
pub fn toggle_expanded(&mut self)
Toggle the expanded state of a directory.
Trait Implementations§
impl StructuralPartialEq for FileNode
Auto Trait Implementations§
impl Freeze for FileNode
impl RefUnwindSafe for FileNode
impl Send for FileNode
impl Sync for FileNode
impl Unpin for FileNode
impl UnsafeUnpin for FileNode
impl UnwindSafe for FileNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.