[][src]Struct filetools::filehelpers::FileHelpers

pub struct FileHelpers;

Methods

impl FileHelpers[src]

pub fn ensure_dir(dir_name: PathBuf) -> Result<()>[src]

Ensures a directory is created from a PathBuf Does nothing if the directory already exists

Returns Ok if successful, Err if not

pub fn is_subdir(path: PathBuf, directory: PathBuf) -> Result<bool>[src]

Determines if a path if a subdirectory of the given directory Creates the absolute paths and checks the ancestors of path to determine if a subdirectory

Note::Not entirely sure this works perfectly fine, use at own risk

Returns Ok(true) if path is a subdirectory, Ok(false) if not, Err if error occured

pub fn path_contains(path: PathBuf, search_str: &str) -> bool[src]

Determines if a given PathBuf contains a search string

Returns true if search string present, else false

pub fn list_files(path: PathBuf, recursive: bool) -> Result<Vec<PathBuf>>[src]

Lists all files in a given path If recursive is set, iterates through all subfolders recursively to find all files If recursive not set, just finds all files in the current directory

Return Vec<PathBuf> of all files in a directory and subdirectories

pub fn list_folders(path: PathBuf, recursive: bool) -> Result<Vec<PathBuf>>[src]

Lists all folders in a given path If recursive is set, iterates through all subfolders recursively to find all folders If recursive not set, just finds all files in the current directory Mirrors the functionality of FileHelpers::list_files()

Return Vec<PathBuf> of all folders in a directory and subdirectories

Auto Trait Implementations

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,