Struct direx::DirInfo

source ·
pub struct DirInfo {
    pub path: Arc<str>,
    pub files: Vec<FileInfo>,
    pub dirs: Vec<DirInfo>,
}

Fields§

§path: Arc<str>§files: Vec<FileInfo>§dirs: Vec<DirInfo>

Implementations§

source§

impl DirInfo

source

pub fn walk_dir<P: AsRef<Path>>(path: P) -> Result<DirInfo>

深度搜索该文件夹的普通文件和文件夹信息

source

pub fn is_empty_dir(&self) -> bool

递归判断文件夹和子文件夹里是否为空

source

pub fn cut_empty_dir(&mut self)

递归删除空的子文件夹

source

pub fn all_files(&self) -> Vec<&FileInfo>

返回所有文件的目录名和文件名

source

pub fn all_files_map<F, T>(&self, f: F) -> Vec<T>where F: Fn(&FileInfo) -> T, T: FromIterator<T>,

source

pub fn all_files_str(&self) -> Vec<String>

👎Deprecated since 0.2.0: replace with all_files_map() or all_files()

返回所有文件的路径名

Warn

会将windows反斜杠粗暴替换成linux斜杠

source

pub fn all_files_abs(&self) -> Vec<String>

返回所有文件的绝对路径名

Trait Implementations§

source§

impl Clone for DirInfo

source§

fn clone(&self) -> DirInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DirInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.