pub trait LexicalAbsolute {
// Required method
fn to_lexical_absolute(&self) -> Result<PathBuf>;
}Expand description
Trait to convert a path to a lexical absolute path. Does not require the path to exist.
§See also
Required Methods§
Sourcefn to_lexical_absolute(&self) -> Result<PathBuf>
fn to_lexical_absolute(&self) -> Result<PathBuf>
Convert a path to a lexical absolute path. Does not require the path to exist.
§Errors
Returns an error if the absolute path could not be determined.
Implementations on Foreign Types§
Source§impl LexicalAbsolute for PathBuf
impl LexicalAbsolute for PathBuf
Source§fn to_lexical_absolute(&self) -> Result<PathBuf>
fn to_lexical_absolute(&self) -> Result<PathBuf>
Convert a path to a lexical absolute path. Does not require the path to exist.
§Example
use std::path::PathBuf;
use backup_deduplicator::utils::LexicalAbsolute;
let path = PathBuf::from("/a/b/../c");
let absolute = path.to_lexical_absolute().unwrap();
assert_eq!(absolute, PathBuf::from("/a/c"));§Errors
Returns an error if the given path is relative and the current working directory could not be determined.
- The working directory does not exist.
- Insufficient permissions to determine the working directory.