pub struct FolderPath { /* private fields */ }Expand description
A folder path.
Implementations§
Source§impl FolderPath
Delete Files
impl FolderPath
Delete Files
Sourcepub fn delete_files(&self) -> Result<(), Error>
pub fn delete_files(&self) -> Result<(), Error>
Deletes all files in the folder recursively.
Source§impl FolderPath
List Files
impl FolderPath
List Files
Sourcepub fn list_files(&self) -> Result<ListFilesOp, Error>
pub fn list_files(&self) -> Result<ListFilesOp, Error>
Creates a list-files operation on the folder.
The files will be returned in lexicographical order.
Sourcepub fn list_files_unsorted(&self) -> Result<ListFilesOp, Error>
pub fn list_files_unsorted(&self) -> Result<ListFilesOp, Error>
Creates a list-files operation on the folder where the files may be unsorted.
Source§impl FolderPath
List Files as Vec
impl FolderPath
List Files as Vec
Sourcepub fn list_files_as_vec(&self) -> Result<Vec<FilePath>, Error>
pub fn list_files_as_vec(&self) -> Result<Vec<FilePath>, Error>
Lists the files in the folder as a Vec<FilePath> sorted in lexicographical order.
Returns Ok(sorted_files).
Sourcepub fn list_files_as_vec_unsorted(&self) -> Result<Vec<FilePath>, Error>
pub fn list_files_as_vec_unsorted(&self) -> Result<Vec<FilePath>, Error>
Lists the files as a Vec<FilePath>.
Returns Ok(files).
Source§impl FolderPath
Construction
impl FolderPath
Construction
Sourcepub unsafe fn new(path: StoragePath) -> Self
pub unsafe fn new(path: StoragePath) -> Self
Source§impl FolderPath
Storage Path
impl FolderPath
Storage Path
Sourcepub fn path(&self) -> &StoragePath
pub fn path(&self) -> &StoragePath
Gets the storage path.
Sourcepub fn to_path(self) -> StoragePath
pub fn to_path(self) -> StoragePath
Converts the folder path to a storage path.
Source§impl FolderPath
Current Working Directory
impl FolderPath
Current Working Directory
Sourcepub fn current_working_directory() -> Result<Self, Error>
pub fn current_working_directory() -> Result<Self, Error>
Gets the current working directory.
Source§impl FolderPath
Roots
impl FolderPath
Roots
Source§impl FolderPath
Temp
impl FolderPath
Temp
Sourcepub fn temp() -> Result<FolderPath, Error>
pub fn temp() -> Result<FolderPath, Error>
Creates a temp folder path. (does not create the folder)
Source§impl FolderPath
Clone
impl FolderPath
Clone
Sourcepub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self
pub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self
Clones the path with the extra capacity.
Methods from Deref<Target = StoragePath>§
Sourcepub fn file_separator(&self) -> char
pub fn file_separator(&self) -> char
Gets the file-separator.
Sourcepub fn clone_to_file(&self) -> Result<FilePath, Error>
pub fn clone_to_file(&self) -> Result<FilePath, Error>
Clones the path and converts it to a file path.
Returns Err if the path is not a file path.
Sourcepub fn clone_to_folder(&self) -> Result<FolderPath, Error>
pub fn clone_to_folder(&self) -> Result<FolderPath, Error>
Clones the path and converts it to a folder path.
Returns Err if the path is not a folder path.
Sourcepub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self
pub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self
Clones the path with the extra capacity.
Sourcepub fn clone_append<S>(&self, string: S) -> Self
pub fn clone_append<S>(&self, string: S) -> Self
Clones the path and appends the string.
The result is the same as path.clone().with_appended(s) but with a single allocation.
Sourcepub fn clone_make_folder(&self) -> FolderPath
pub fn clone_make_folder(&self) -> FolderPath
Clones the path and makes the path a folder.
Returns the path as is if it is already a folder, otherwise appends a file-separator.
Sourcepub fn relative_path(&self) -> &str
pub fn relative_path(&self) -> &str
Gets the relative path (the portion after the base).
Sourcepub fn is_local_path(&self) -> bool
pub fn is_local_path(&self) -> bool
Checks if the path is a local path.
Sourcepub fn is_unix_path(&self) -> bool
pub fn is_unix_path(&self) -> bool
Checks if the path is a Unix path.
Sourcepub fn is_windows_path(&self) -> bool
pub fn is_windows_path(&self) -> bool
Checks if the path is a Windows path.
Trait Implementations§
Source§impl AsRef<FolderPath> for FolderPath
impl AsRef<FolderPath> for FolderPath
Source§fn as_ref(&self) -> &FolderPath
fn as_ref(&self) -> &FolderPath
Source§impl AsRef<OsStr> for FolderPath
impl AsRef<OsStr> for FolderPath
Source§impl AsRef<Path> for FolderPath
impl AsRef<Path> for FolderPath
Source§impl AsRef<str> for FolderPath
impl AsRef<str> for FolderPath
Source§impl Clone for FolderPath
impl Clone for FolderPath
Source§impl Debug for FolderPath
impl Debug for FolderPath
Source§impl Deref for FolderPath
impl Deref for FolderPath
Source§type Target = StoragePath
type Target = StoragePath
Source§fn deref(&self) -> &StoragePath
fn deref(&self) -> &StoragePath
Source§impl Display for FolderPath
impl Display for FolderPath
impl Eq for FolderPath
Source§impl From<FolderPath> for StoragePath
impl From<FolderPath> for StoragePath
Source§fn from(path: FolderPath) -> Self
fn from(path: FolderPath) -> Self
Source§impl Hash for FolderPath
impl Hash for FolderPath
Source§impl Ord for FolderPath
impl Ord for FolderPath
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FolderPath
impl PartialEq for FolderPath
Source§impl PartialOrd for FolderPath
impl PartialOrd for FolderPath
impl StructuralPartialEq for FolderPath
Auto Trait Implementations§
impl Freeze for FolderPath
impl RefUnwindSafe for FolderPath
impl Send for FolderPath
impl Sync for FolderPath
impl Unpin for FolderPath
impl UnsafeUnpin for FolderPath
impl UnwindSafe for FolderPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more