Struct pathio::DirectorySingle

source ·
pub struct DirectorySingle<T> {
    pub file: Option<T>,
    pub directory: AHashMap<String, DirectorySingle<T>>,
    /* private fields */
}
Expand description

DirectorySingle is a special type representing directory in PathTreeSingle

Fields§

§file: Option<T>§directory: AHashMap<String, DirectorySingle<T>>

Implementations§

source§

impl<T> DirectorySingle<T>

source

pub fn new() -> Self

Create new unassigned directory

Trait Implementations§

source§

impl<T: Clone> Clone for DirectorySingle<T>

source§

fn clone(&self) -> DirectorySingle<T>

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<T: Debug> Debug for DirectorySingle<T>

source§

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

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

impl<T: Default> Default for DirectorySingle<T>

source§

fn default() -> DirectorySingle<T>

Returns the “default value” for a type. Read more
source§

impl<T> Into<DirectorySingle<T>> for PathTreeSingle<T>

source§

fn into(self) -> DirectorySingle<T>

Converts this type into the (usually inferred) input type.
source§

impl<T: PartialEq> PartialEq<DirectorySingle<T>> for DirectorySingle<T>

source§

fn eq(&self, other: &DirectorySingle<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PathioFile<T> for DirectorySingle<T>

source§

fn add_file(&mut self, file: T) -> Option<T>

Adds file directly to this directory and return existing one
source§

fn insert_file( &mut self, file: T, path: impl Borrow<str> ) -> Result<Option<T>, PathioError>

Inserts file to self or any subdirectory and return existing one
source§

fn take_file(&mut self) -> Option<T>

Removes file from self and returns it
source§

fn remove_file( &mut self, path: impl Borrow<str> ) -> Result<Option<T>, PathioError>

Removes file from self or any subdirectory and returns it
source§

fn obtain_file(&self) -> Option<&T>

Borrow file from self
source§

fn obtain_file_mut(&mut self) -> Option<&mut T>

Borrow file from self
source§

fn borrow_file(&self, path: impl Borrow<str>) -> Result<Option<&T>, PathioError>

Borrow file from self or any subdirectory
source§

fn borrow_file_mut( &mut self, path: impl Borrow<str> ) -> Result<Option<&mut T>, PathioError>

Borrow file from self or any subdirectory
source§

impl<T> PathioHierarchy<DirectorySingle<T>> for DirectorySingle<T>

source§

fn add_directory( &mut self, directory: DirectorySingle<T>, name: impl Borrow<str> ) -> Result<(), PathioError>

Adds subdirectory directly to this directory
source§

fn insert_directory( &mut self, directory: DirectorySingle<T>, path: impl Borrow<str> ) -> Result<(), PathioError>

Inserts subdirectory to self or any subdirectory
source§

fn create_directory( &mut self, path: impl Borrow<str> ) -> Result<(), PathioError>

Creates subdirectory in root or any subdirectory
source§

fn take_directory( &mut self, name: impl Borrow<str> ) -> Result<DirectorySingle<T>, PathioError>

Removes directory from self and returns it
source§

fn remove_directory( &mut self, path: impl Borrow<str> ) -> Result<DirectorySingle<T>, PathioError>

Removes directory from self or any subdirectory and returns it
source§

fn obtain_directory( &self, name: impl Borrow<str> ) -> Result<&DirectorySingle<T>, PathioError>

Borrow directory from self
source§

fn obtain_directory_mut( &mut self, name: impl Borrow<str> ) -> Result<&mut DirectorySingle<T>, PathioError>

Borrow directory from self
source§

fn borrow_directory( &self, path: impl Borrow<str> ) -> Result<&DirectorySingle<T>, PathioError>

Borrow directory from self or any subdirectory
source§

fn borrow_directory_mut( &mut self, path: impl Borrow<str> ) -> Result<&mut DirectorySingle<T>, PathioError>

Borrow directory from self or any subdirectory
source§

fn merge( &mut self, directory: impl Into<DirectorySingle<T>> ) -> Result<(), PathioError>

Merges PathTree or Directory content into itself
source§

fn list(&self) -> String

Generate overview of the inner tree in a stringified form
source§

fn get_name(&self) -> &String

Returns cached name
source§

fn get_depth(&self) -> f32

Returns cached depth
source§

fn get_path(&self) -> &String

Returns cached name
source§

impl<T> PathioHierarchy<DirectorySingle<T>> for PathTreeSingle<T>

source§

fn add_directory( &mut self, directory: DirectorySingle<T>, name: impl Borrow<str> ) -> Result<(), PathioError>

Adds subdirectory directly to this directory
source§

fn insert_directory( &mut self, directory: DirectorySingle<T>, path: impl Borrow<str> ) -> Result<(), PathioError>

Inserts subdirectory to self or any subdirectory
source§

fn create_directory( &mut self, path: impl Borrow<str> ) -> Result<(), PathioError>

Creates subdirectory in root or any subdirectory
source§

fn take_directory( &mut self, name: impl Borrow<str> ) -> Result<DirectorySingle<T>, PathioError>

Removes directory from self and returns it
source§

fn remove_directory( &mut self, path: impl Borrow<str> ) -> Result<DirectorySingle<T>, PathioError>

Removes directory from self or any subdirectory and returns it
source§

fn obtain_directory( &self, name: impl Borrow<str> ) -> Result<&DirectorySingle<T>, PathioError>

Borrow directory from self
source§

fn obtain_directory_mut( &mut self, name: impl Borrow<str> ) -> Result<&mut DirectorySingle<T>, PathioError>

Borrow directory from self
source§

fn borrow_directory( &self, path: impl Borrow<str> ) -> Result<&DirectorySingle<T>, PathioError>

Borrow directory from self or any subdirectory
source§

fn borrow_directory_mut( &mut self, path: impl Borrow<str> ) -> Result<&mut DirectorySingle<T>, PathioError>

Borrow directory from self or any subdirectory
source§

fn merge( &mut self, directory: impl Into<DirectorySingle<T>> ) -> Result<(), PathioError>

Merges PathTree or Directory content into itself
source§

fn list(&self) -> String

Generate overview of the inner tree in a stringified form
source§

fn get_name(&self) -> &String

Returns cached name
source§

fn get_depth(&self) -> f32

Returns cached depth
source§

fn get_path(&self) -> &String

Returns cached name
source§

impl<T> StructuralPartialEq for DirectorySingle<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for DirectorySingle<T>where T: RefUnwindSafe,

§

impl<T> Send for DirectorySingle<T>where T: Send,

§

impl<T> Sync for DirectorySingle<T>where T: Sync,

§

impl<T> Unpin for DirectorySingle<T>where T: Unpin,

§

impl<T> UnwindSafe for DirectorySingle<T>where T: UnwindSafe,

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more