pub struct WalkFileEntry {
pub root: PathBuf,
pub child_dirs: Vec<String>,
pub child_files: Vec<String>,
}
Expand description
§WalfFileENtry
- root: 根目录
- child_dirs: root下所有的子文件夹名称
- child_files: root下所有的文件
Fields§
§root: PathBuf
§child_dirs: Vec<String>
§child_files: Vec<String>
Implementations§
Source§impl WalkFileEntry
impl WalkFileEntry
Sourcepub fn as_tuple_ref(&self) -> (&PathBuf, &Vec<String>, &Vec<String>)
pub fn as_tuple_ref(&self) -> (&PathBuf, &Vec<String>, &Vec<String>)
将属性以引用的方式构造成元组
use std::{path::PathBuf, str::FromStr};
use crate::walk;
use anyhow::{Ok, Result};
fn test_ref_tuple(){
let res = walk(&PathBuf::from_str("./").unwrap());
let res = match res {
Err(e) => panic!("{}", e),
Ok(res) => res
};
let (root, child_dirs, child_files) = res[0].as_tuple_ref();
println!("{:?}, {:?}, {:?}", root, child_dirs, child_files);
}
Sourcepub fn as_tuple(&self) -> (PathBuf, Vec<String>, Vec<String>)
pub fn as_tuple(&self) -> (PathBuf, Vec<String>, Vec<String>)
将属性以克隆的方式构造成元组
use std::{path::PathBuf, str::FromStr};
use crate::walk;
use anyhow::{Ok, Result};
fn test_ref_tuple(){
let res = walk(&PathBuf::from_str("./").unwrap());
let res = match res {
Err(e) => panic!("{}", e),
Ok(res) => res
};
let (root, child_dirs, child_files) = res[0].as_tuple();
println!("{:?}, {:?}, {:?}", root, child_dirs, child_files);
}
Trait Implementations§
Source§impl Clone for WalkFileEntry
impl Clone for WalkFileEntry
Source§fn clone(&self) -> WalkFileEntry
fn clone(&self) -> WalkFileEntry
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WalkFileEntry
impl Debug for WalkFileEntry
Auto Trait Implementations§
impl Freeze for WalkFileEntry
impl RefUnwindSafe for WalkFileEntry
impl Send for WalkFileEntry
impl Sync for WalkFileEntry
impl Unpin for WalkFileEntry
impl UnwindSafe for WalkFileEntry
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
Mutably borrows from an owned value. Read more