pub enum ContainerPath {
File(String),
Folder(String),
}Expand description
This enum represents a Path inside a Container.
Variants§
File(String)
This variant represents the path of a single file.
Folder(String)
This variant represents the path of a single folder.
If this is empty, it represents the root of the container.
Implementations§
Source§impl ContainerPath
impl ContainerPath
Sourcepub fn is_file(&self) -> bool
pub fn is_file(&self) -> bool
This function returns true if the provided ContainerPath corresponds to a file.
Sourcepub fn is_folder(&self) -> bool
pub fn is_folder(&self) -> bool
This function returns true if the provided ContainerPath corresponds to a folder.
Sourcepub fn is_pack(&self) -> bool
pub fn is_pack(&self) -> bool
This function returns true if the provided ContainerPath corresponds to a root Pack.
Sourcepub fn path_raw(&self) -> &str
pub fn path_raw(&self) -> &str
This function returns a reference to the path stored within the provided ContainerPath.
Sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
This function returns the last item of the provided ContainerPath, if any.
Sourcepub fn db_table_name_from_path(&self) -> Option<&str>
pub fn db_table_name_from_path(&self) -> Option<&str>
This function the table_name of this file (the folder that contains this file) if this file is a DB table.
It returns None of the file provided is not a DB Table.
Sourcepub fn parent_path(&self) -> String
pub fn parent_path(&self) -> String
This function returns the path of the parent folder of the provided ContainerPath.
If the provided ContainerPath corresponds to a Container root, the path returned will be the current one.
Sourcepub fn dedup(paths: &[Self]) -> Vec<Self>
pub fn dedup(paths: &[Self]) -> Vec<Self>
This function removes collided items from the provided list of ContainerPath.
This means, if you have a file and a folder containing the file, it removes the file.
Trait Implementations§
Source§impl Clone for ContainerPath
impl Clone for ContainerPath
Source§fn clone(&self) -> ContainerPath
fn clone(&self) -> ContainerPath
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContainerPath
impl Debug for ContainerPath
Source§impl<'de> Deserialize<'de> for ContainerPath
impl<'de> Deserialize<'de> for ContainerPath
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for ContainerPath
impl Hash for ContainerPath
Source§impl Ord for ContainerPath
impl Ord for ContainerPath
Source§impl PartialEq for ContainerPath
impl PartialEq for ContainerPath
Source§impl PartialOrd for ContainerPath
impl PartialOrd for ContainerPath
Source§impl Serialize for ContainerPath
impl Serialize for ContainerPath
impl Eq for ContainerPath
impl StructuralPartialEq for ContainerPath
Auto Trait Implementations§
impl Freeze for ContainerPath
impl RefUnwindSafe for ContainerPath
impl Send for ContainerPath
impl Sync for ContainerPath
impl Unpin for ContainerPath
impl UnsafeUnpin for ContainerPath
impl UnwindSafe for ContainerPath
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<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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.