pub struct AbsolutePath(PathBuf);
Expand description
A representation of an absolute path
AbsolutePath wraps a PathBuf
, that is guaranteed to be absolute.
§Examples
use std::path::PathBuf;
use std::str::FromStr;
use alpm_types::{AbsolutePath, Error};
// Create AbsolutePath from &str
assert_eq!(
AbsolutePath::from_str("/"),
AbsolutePath::new(PathBuf::from("/"))
);
assert_eq!(
AbsolutePath::from_str("./"),
Err(Error::PathNotAbsolute(PathBuf::from("./")))
);
// Format as String
assert_eq!("/", format!("{}", AbsolutePath::from_str("/")?));
Tuple Fields§
§0: PathBuf
Implementations§
Trait Implementations§
source§impl Clone for AbsolutePath
impl Clone for AbsolutePath
source§fn clone(&self) -> AbsolutePath
fn clone(&self) -> AbsolutePath
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AbsolutePath
impl Debug for AbsolutePath
source§impl Display for AbsolutePath
impl Display for AbsolutePath
source§impl FromStr for AbsolutePath
impl FromStr for AbsolutePath
source§impl PartialEq for AbsolutePath
impl PartialEq for AbsolutePath
impl Eq for AbsolutePath
impl StructuralPartialEq for AbsolutePath
Auto Trait Implementations§
impl Freeze for AbsolutePath
impl RefUnwindSafe for AbsolutePath
impl Send for AbsolutePath
impl Sync for AbsolutePath
impl Unpin for AbsolutePath
impl UnwindSafe for AbsolutePath
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)