pub trait FileDirEntry {
    // Required methods
    fn entry_type(&self) -> &FileDirTypes;
    fn name(&self) -> &str;
    fn timestamp(&self) -> &str;
    fn length(&mut self) -> i32;
    fn children(&self) -> Option<&Vec<Rc<RefCell<dyn FileDirEntry>>>>;
}
Expand description

Represents an entry in a hierarchical list of objects composed of files and directories, where the directories can contain nested files and directories. This is a trait as it is the only way to represent a polymorphic concept like the composite design pattern where all the entries look the same to the rest of the program.

Required Methods§

source

fn entry_type(&self) -> &FileDirTypes

Returns a reference to the FileDirTypes value representing the type of entry this trait represents.

source

fn name(&self) -> &str

Returns a reference to the name of this entry.

source

fn timestamp(&self) -> &str

Returns a reference to the timestamp of this entry.

source

fn length(&mut self) -> i32

Returns the length of this entry.

source

fn children(&self) -> Option<&Vec<Rc<RefCell<dyn FileDirEntry>>>>

Returns an Option<> containing a reference to the vector of the children of this entry. If there are no children, returns None.

Implementors§