Struct ciruela::VPath [−][src]
pub struct VPath(_);
Virtual path for uploading images
Basically it's an Arc<PathBuf>
so it clones cheaply, but also has
convenience methods for extracting features specific to our
virtual paths.
The anatomy of the virtual path:
/[key]/[suffix]
Type asserts on the presence of the key
and that the path is absolute.
Suffix might be of arbitrary length including zero.
Methods
impl VPath
[src]
impl VPath
pub fn key(&self) -> &str
[src]
pub fn key(&self) -> &str
Returns a key
, i.e. the first component
pub fn key_vpath(&self) -> VPath
[src]
pub fn key_vpath(&self) -> VPath
Returns a key
, i.e. the first component
pub fn level(&self) -> usize
[src]
pub fn level(&self) -> usize
Returns a level of a directory
Level is number of path components not counting a key
pub fn parent_rel(&self) -> &Path
[src]
pub fn parent_rel(&self) -> &Path
Return parent path relative to a key
Panics
Panics if the directory contains only a key (has single component)
pub fn parent(&self) -> VPath
[src]
pub fn parent(&self) -> VPath
Return virtual path of the directory
Panics
Panics if the directory contains only a key (has single component)
pub fn suffix(&self) -> &Path
[src]
pub fn suffix(&self) -> &Path
The path relative to the key
pub fn final_name(&self) -> &str
[src]
pub fn final_name(&self) -> &str
pub fn join<P: AsRef<Path>>(&self, path: P) -> VPath
[src]
pub fn join<P: AsRef<Path>>(&self, path: P) -> VPath
Join path to the virtual path
Panics
Panics if suffix is invalid: empty, root or has parent ..
components
pub fn from<T: Into<PathBuf>>(t: T) -> VPath
[src]
pub fn from<T: Into<PathBuf>>(t: T) -> VPath
Create a virtual path from path
Panics
Panics if path is not absolute or doesn't contain directory components
pub fn try_from<T: Into<PathBuf>>(t: T) -> Result<VPath, PathError>
[src]
pub fn try_from<T: Into<PathBuf>>(t: T) -> Result<VPath, PathError>
Create a virtual path from path
pub fn matches_basedir(&self, base_dir: &VPath) -> bool
[src]
pub fn matches_basedir(&self, base_dir: &VPath) -> bool
Check this directory belongs to the specified basedir
Technically the same, but faster version of:
self.parent() == base_dir
Trait Implementations
impl PartialEq for VPath
[src]
impl PartialEq for VPath
fn eq(&self, other: &VPath) -> bool
[src]
fn eq(&self, other: &VPath) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &VPath) -> bool
[src]
fn ne(&self, other: &VPath) -> bool
This method tests for !=
.
impl Eq for VPath
[src]
impl Eq for VPath
impl Hash for VPath
[src]
impl Hash for VPath
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialOrd for VPath
[src]
impl PartialOrd for VPath
fn partial_cmp(&self, other: &VPath) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &VPath) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &VPath) -> bool
[src]
fn lt(&self, other: &VPath) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &VPath) -> bool
[src]
fn le(&self, other: &VPath) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &VPath) -> bool
[src]
fn gt(&self, other: &VPath) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &VPath) -> bool
[src]
fn ge(&self, other: &VPath) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for VPath
[src]
impl Ord for VPath
fn cmp(&self, other: &VPath) -> Ordering
[src]
fn cmp(&self, other: &VPath) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Clone for VPath
[src]
impl Clone for VPath
fn clone(&self) -> VPath
[src]
fn clone(&self) -> VPath
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Borrow<Path> for VPath
[src]
impl Borrow<Path> for VPath
impl AsRef<Path> for VPath
[src]
impl AsRef<Path> for VPath
impl<'de> Deserialize<'de> for VPath
[src]
impl<'de> Deserialize<'de> for VPath
fn deserialize<D>(deserializer: D) -> Result<VPath, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<VPath, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Display for VPath
[src]
impl Display for VPath
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for VPath
[src]
impl Debug for VPath