Struct etc::Etc

source ·
pub struct Etc(/* private fields */);
Expand description

contains dir and file

Implementations§

source§

impl Etc

source

pub fn new<P>(root: P) -> Result<Etc, Error>
where P: AsRef<Path> + Sized,

Abstract an etc dir

source

pub fn is_root(&self) -> bool

Check if is /

source

pub fn tree(self) -> Result<Tree, Error>

Convert Etc to Tree

Trait Implementations§

source§

impl Clone for Etc

source§

fn clone(&self) -> Etc

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 Etc

source§

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

Formats the value using the given formatter. Read more
source§

impl From<Etc> for PathBuf

source§

fn from(val: Etc) -> Self

Converts to this type from the input type.
source§

impl From<Etc> for String

source§

fn from(val: Etc) -> Self

Converts to this type from the input type.
source§

impl<P> From<P> for Etc
where P: AsRef<Path> + Sized,

source§

fn from(p: P) -> Etc

Converts to this type from the input type.
source§

impl Meta for Etc

source§

fn real_path(&self) -> Result<PathBuf, Error>

real path
source§

fn base(&self) -> Result<PathBuf, Error>

base directory
source§

fn name(&self) -> Result<String, Error>

current working directory

Auto Trait Implementations§

§

impl Freeze for Etc

§

impl RefUnwindSafe for Etc

§

impl Send for Etc

§

impl Sync for Etc

§

impl Unpin for Etc

§

impl UnwindSafe for Etc

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> FileSystem for T
where T: Meta,

source§

fn drain(&self) -> Result<(), Error>

remove current dir or file
source§

fn back(&self) -> Result<Etc, Error>

opens a file in write-only mode.
source§

fn entry<F>(&self, name: &str, f: F) -> Result<(), Error>
where F: FnOnce(Etc),

entry of a file
source§

fn find(&self, src: &str) -> Result<PathBuf, Error>

find target
source§

fn find_all(&self, src: &str, res: &mut Vec<PathBuf>) -> Result<(), Error>

find all target
source§

fn ls(&self) -> Result<Vec<String>, Error>

list sources
source§

fn mkdir<P>(&self, path: P) -> Result<(), Error>
where P: AsRef<str>,

create dir under root
source§

fn open(&self, name: &str) -> Result<Etc, Error>

opens a file in write-only mode.
source§

fn rm(&self, path: &str) -> Result<(), Error>

remove dir or file
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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> Read for T
where T: Meta,

source§

fn read(&self) -> Result<Vec<u8>, Error>

read stream from file
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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.
source§

impl<T> Write for T
where T: Meta,

source§

fn write<B>(&self, stream: B) -> Result<(), Error>
where B: AsRef<[u8]>,

write stream into file