[][src]Struct etc::Tree

pub struct Tree {
    pub path: PathBuf,
    pub content: Option<Vec<u8>>,
    pub children: Option<Vec<Tree>>,
}

Here are two file types in Tree

  • Dir - no contents, have children
  • File - have contents, no children

Fields

path: PathBuf

File path

content: Option<Vec<u8>>

File content

children: Option<Vec<Tree>>

Children files

Implementations

impl Tree[src]

pub fn batch<Fs>(src: Fs) -> Result<Tree, Error> where
    Fs: FileSystem
[src]

Batch all files into a tree, we can use this to implement some pre build stuffs.

pub fn load(&mut self) -> Result<(), Error>[src]

Load file contents

pub fn map<F>(&mut self, f: F) where
    F: FnMut(&mut Tree) + Sized + Copy
[src]

Map the whole tree

pub fn redir<P>(&mut self, path: P) -> Result<(), Error> where
    P: AsRef<Path> + Sized
[src]

Redir tree path, just like cp -r in unix

pub fn refresh(self) -> Result<Tree, Error>[src]

Refresh children

Trait Implementations

impl Debug for Tree[src]

impl Default for Tree[src]

impl Eq for Tree[src]

impl<'_> Into<Vec<PathBuf, Global>> for &'_ Tree[src]

impl<'_> Into<Vec<PathBuf, Global>> for &'_ mut Tree[src]

impl<'_> Into<Vec<Tree, Global>> for &'_ Tree[src]

impl<'_> Into<Vec<Tree, Global>> for &'_ mut Tree[src]

impl PartialEq<Tree> for Tree[src]

impl StructuralEq for Tree[src]

impl StructuralPartialEq for Tree[src]

Auto Trait Implementations

impl RefUnwindSafe for Tree

impl Send for Tree

impl Sync for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.