pub struct Directory {
pub path: Arc<Path>,
pub content: Vec<FileInfo>,
pub index: usize,
/* private fields */
}Expand description
Holds the information about file in the current directory. We know about the current path, the files themselves, the selected index, the “display all files including hidden” flag and the key to sort files.
Fields§
§path: Arc<Path>The current path
content: Vec<FileInfo>A vector of FileInfo with every file in current path
index: usizeThe index of the selected file.
Implementations§
Source§impl Directory
impl Directory
Sourcepub fn new(
path: &Path,
users: &Users,
filter: &FilterKind,
show_hidden: bool,
) -> Result<Self>
pub fn new( path: &Path, users: &Users, filter: &FilterKind, show_hidden: bool, ) -> Result<Self>
Reads the paths and creates a new PathContent.
Files are sorted by filename by default.
Selects the first file if any.
pub fn change_directory( &mut self, path: &Path, settings: &TabSettings, users: &Users, ) -> Result<()>
Sourcepub fn owner_column_width(&self) -> usize
pub fn owner_column_width(&self) -> usize
Calculates the size of the owner column.
Sourcepub fn group_column_width(&self) -> usize
pub fn group_column_width(&self) -> usize
Calculates the size of the group column.
Sourcepub fn select_index(&mut self, index: usize)
pub fn select_index(&mut self, index: usize)
Select the file from a given index.
Sourcepub fn reset_files(
&mut self,
settings: &TabSettings,
users: &Users,
) -> Result<()>
pub fn reset_files( &mut self, settings: &TabSettings, users: &Users, ) -> Result<()>
Reset the current file content. Reads and sort the content with current key. Select the first file if any.
Sourcepub fn is_selected_dir(&self) -> Result<bool>
pub fn is_selected_dir(&self) -> Result<bool>
Is the selected file a directory ? It may fails if the current path is empty, aka if nothing is selected.
Sourcepub fn used_space(&self) -> String
pub fn used_space(&self) -> String
Human readable string representation of the space used by files in current path. No recursive exploration of directory.
Sourcepub fn git_string(&self) -> Result<String>
pub fn git_string(&self) -> Result<String>
A string representation of the git status of the path.
Sourcepub fn iter(&self) -> Iter<'_, FileInfo>
pub fn iter(&self) -> Iter<'_, FileInfo>
Returns an iterator of the files (FileInfo) in content.
Sourcepub fn enumerate(&self) -> Enumerate<Iter<'_, FileInfo>>
pub fn enumerate(&self) -> Enumerate<Iter<'_, FileInfo>>
Returns an enumeration of the files (FileInfo) in content.
Sourcepub fn select_file(&mut self, jump_target: &Path) -> usize
pub fn select_file(&mut self, jump_target: &Path) -> usize
Select the file from its path. Returns its index in content.
Sourcepub fn is_dotdot_selected(&self) -> bool
pub fn is_dotdot_selected(&self) -> bool
True iff the selected path is “..” which is the parent dir.
pub fn videos(&self) -> VecDeque<PathBuf>
Trait Implementations§
Source§impl Content<FileInfo> for Directory
Implement a selectable content for this struct.
This trait allows to navigate through a vector of element content_type.
It implements: is_empty, len, next, prev, selected.
selected returns an optional reference to the value.
impl Content<FileInfo> for Directory
Implement a selectable content for this struct.
This trait allows to navigate through a vector of element content_type.
It implements: is_empty, len, next, prev, selected.
selected returns an optional reference to the value.
Source§impl IndexToIndex<FileInfo> for Directory
impl IndexToIndex<FileInfo> for Directory
Source§impl Selectable for Directory
Implement a selectable content for this struct.
This trait allows to navigate through a vector of element content_type.
It implements: is_empty, len, next, prev, selected.
selected returns an optional reference to the value.
impl Selectable for Directory
Implement a selectable content for this struct.
This trait allows to navigate through a vector of element content_type.
It implements: is_empty, len, next, prev, selected.
selected returns an optional reference to the value.
Auto Trait Implementations§
impl Freeze for Directory
impl RefUnwindSafe for Directory
impl Send for Directory
impl Sync for Directory
impl Unpin for Directory
impl UnwindSafe for Directory
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more