Enum path_abs::PathType
[−]
[src]
pub enum PathType { File(PathFile), Dir(PathDir), }
An an enum containing either a file or a directory.
This is used primarily for:
- The items returned from PathDir::list
- Serializing paths of different types.
Note: symlinks are not supported because they are impossible for canonicalized paths.
Variants
File(PathFile)
Dir(PathDir)
Methods
impl PathType
[src]
fn new<P: AsRef<Path>>(path: P) -> Result<PathType>
[src]
Resolves and returns the PathType
of the given path.
If the path exists but is not a file or a directory (i.e. is a symlink), then
io::ErrorKind::InvalidInput
is returned.
Examples
use path_abs::PathType; let src = PathType::new("src")?;
fn from_abs(abs: PathAbs) -> Result<PathType>
[src]
Consume the PathAbs
returning the PathType
.
fn unwrap_file(self) -> PathFile
[src]
Unwrap the PathType
as a PathFile
.
Examples
use path_abs::PathType; let lib = PathType::new("src/lib.rs")?.unwrap_file();
fn unwrap_dir(self) -> PathDir
[src]
Unwrap the PathType
as a PathDir
.
Examples
use path_abs::PathType; let src = PathType::new("src")?.unwrap_dir();
fn is_dir(&self) -> bool
[src]
Return whether this variant is PathType::Dir
.
fn is_file(&self) -> bool
[src]
Return whether this variant is PathType::File
.
fn mock_file<P: AsRef<Path>>(path: P) -> PathType
[src]
Create a mock file type. For use in tests only.
See the docs for PathAbs::mock
fn mock_dir<P: AsRef<Path>>(path: P) -> PathType
[src]
Create a mock dir type. For use in tests only.
See the docs for PathAbs::mock
Trait Implementations
impl Debug for PathType
[src]
impl Clone for PathType
[src]
fn clone(&self) -> PathType
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for PathType
[src]
impl Hash for PathType
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
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]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for PathType
[src]
fn eq(&self, __arg_0: &PathType) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &PathType) -> bool
[src]
This method tests for !=
.
impl PartialOrd for PathType
[src]
fn partial_cmp(&self, __arg_0: &PathType) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &PathType) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &PathType) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &PathType) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &PathType) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for PathType
[src]
fn cmp(&self, __arg_0: &PathType) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more