Struct abscissa_core::path::AbsPathBuf [−][src]
An owned path on the filesystem which is guaranteed to be canonical.
More specifically: it is at least guaranteed to be canonical at the time it is created. There are potential TOCTTOU problems if the underlying filesystem structure changes after path canonicalization.
Implementations
impl CanonicalPathBuf
[src]
pub fn canonicalize<P>(path: P) -> Result<CanonicalPathBuf, Error> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Create a canonical path by first canonicalizing the given path.
pub fn new<P>(path: P) -> Result<CanonicalPathBuf, Error> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Create a canonical path, returning error if the supplied path is not canonical.
pub fn as_canonical_path(&self) -> &CanonicalPath
[src]
Return a CanonicalPath
reference.
pub fn set_file_name<S>(&mut self, file_name: S) where
S: AsRef<OsStr>,
[src]
S: AsRef<OsStr>,
Updates self
's filename ala the same method on PathBuf
pub fn set_extension<S>(&mut self, extension: S) -> bool where
S: AsRef<OsStr>,
[src]
S: AsRef<OsStr>,
Updates self.extension
to extension.
Returns false
and does nothing if self.file_name
is None
,
returns true
and updates the extension otherwise.
If self.extension
is None
, the extension is added; otherwise it is replaced.
pub fn into_path_buf(self) -> PathBuf
[src]
Consumes the CanonicalPathBuf
, yielding its internal PathBuf
storage.
pub fn into_os_string(self) -> OsString
[src]
Consumes the CanonicalPathBuf
, yielding its internal OsString
storage.
pub fn as_path(&self) -> &Path
[src]
Return a Path
reference.
pub fn as_os_str(&self) -> &OsStr
[src]
Return an OsStr
reference.
pub fn to_str(&self) -> Option<&str>
[src]
Yields a &str
slice if the path is valid unicode.
pub fn parent(&self) -> Result<CanonicalPathBuf, Error>
[src]
Return a canonical parent path of this path, or io::Error
if the
path is the root directory or another canonicalization error occurs.
pub fn file_name(&self) -> Option<&OsStr>
[src]
Returns the final component of the path, if there is one.
pub fn starts_with<P>(&self, base: P) -> bool where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Determines whether base is a prefix of self.
pub fn ends_with<P>(&self, child: P) -> bool where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Determines whether child is a suffix of self.
pub fn file_stem(&self) -> Option<&OsStr>
[src]
Extracts the stem (non-extension) portion of self.file_name
.
pub fn extension(&self) -> Option<&OsStr>
[src]
Extracts the extension of self.file_name
, if possible.
pub fn with_file_name<S>(&self, file_name: S) -> Result<CanonicalPathBuf, Error> where
S: AsRef<OsStr>,
[src]
S: AsRef<OsStr>,
Creates an owned CanonicalPathBuf
like self but with the given file name.
pub fn with_extension<S>(&self, extension: S) -> Result<CanonicalPathBuf, Error> where
S: AsRef<OsStr>,
[src]
S: AsRef<OsStr>,
Creates an owned CanonicalPathBuf
like self but with the given extension.
pub fn components(&self) -> Components<'_>
[src]
Produces an iterator over the Component
s of a path
pub fn iter(&self) -> Iter<'_>
[src]
Produces an iterator over the path's components viewed as
OsStr
slices.
pub fn display(&self) -> Display<'_>
[src]
Returns an object that implements Display
for safely printing
paths that may contain non-Unicode data.
pub fn metadata(&self) -> Result<Metadata, Error>
[src]
Queries the file system to get information about a file, directory, etc.
Unlike the std
version of this method, it will not follow symlinks,
since as a canonical path we should be symlink-free.
pub fn join<P>(&self, path: P) -> Result<CanonicalPathBuf, Error> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Join a path onto a canonical path, returning a CanonicalPathBuf
.
pub fn read_dir(&self) -> Result<ReadDir, Error>
[src]
Returns an iterator over the entries within a directory.
The iterator will yield instances of io::Result
This is an alias to fs::read_dir.
pub fn exists(&self) -> bool
[src]
Does this path exist?
pub fn is_file(&self) -> bool
[src]
Is this path a file?
pub fn is_dir(&self) -> bool
[src]
Is this path a directory?
Trait Implementations
impl AsRef<CanonicalPath> for CanonicalPathBuf
[src]
pub fn as_ref(&self) -> &CanonicalPath
[src]
impl AsRef<OsStr> for CanonicalPathBuf
[src]
impl AsRef<Path> for CanonicalPathBuf
[src]
impl Borrow<CanonicalPath> for CanonicalPathBuf
[src]
pub fn borrow(&self) -> &CanonicalPath
[src]
impl Clone for CanonicalPathBuf
[src]
pub fn clone(&self) -> CanonicalPathBuf
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CanonicalPathBuf
[src]
impl Eq for CanonicalPathBuf
[src]
impl Hash for CanonicalPathBuf
[src]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for CanonicalPathBuf
[src]
pub fn cmp(&self, other: &CanonicalPathBuf) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<CanonicalPathBuf> for CanonicalPathBuf
[src]
pub fn eq(&self, other: &CanonicalPathBuf) -> bool
[src]
pub fn ne(&self, other: &CanonicalPathBuf) -> bool
[src]
impl PartialOrd<CanonicalPathBuf> for CanonicalPathBuf
[src]
pub fn partial_cmp(&self, other: &CanonicalPathBuf) -> Option<Ordering>
[src]
pub fn lt(&self, other: &CanonicalPathBuf) -> bool
[src]
pub fn le(&self, other: &CanonicalPathBuf) -> bool
[src]
pub fn gt(&self, other: &CanonicalPathBuf) -> bool
[src]
pub fn ge(&self, other: &CanonicalPathBuf) -> bool
[src]
impl StructuralEq for CanonicalPathBuf
[src]
impl StructuralPartialEq for CanonicalPathBuf
[src]
Auto Trait Implementations
impl RefUnwindSafe for CanonicalPathBuf
[src]
impl Send for CanonicalPathBuf
[src]
impl Sync for CanonicalPathBuf
[src]
impl Unpin for CanonicalPathBuf
[src]
impl UnwindSafe for CanonicalPathBuf
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
[src]
T: Any,
pub fn as_any(&Self) -> &(dyn Any + 'static)
[src]
pub fn as_mut_any(&mut Self) -> &mut (dyn Any + 'static)
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<D> OwoColorize for D
pub fn fg<C>(&'a self) -> FgColorDisplay<'a, C, Self> where
C: Color,
C: Color,
pub fn bg<C>(&'a self) -> BgColorDisplay<'a, C, Self> where
C: Color,
C: Color,
pub fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
pub fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
pub fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
pub fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
pub fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
pub fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
pub fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
pub fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
pub fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
pub fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
pub fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
pub fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
pub fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
pub fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
pub fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
pub fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
pub fn white(&'a self) -> FgColorDisplay<'a, White, Self>
pub fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
pub fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
pub fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
pub fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
pub fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
pub fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
pub fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
pub fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
pub fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
pub fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
pub fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
pub fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
pub fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
pub fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
pub fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
pub fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
pub fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
pub fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
pub fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
pub fn bold(&'a self) -> BoldDisplay<'a, Self>
pub fn dimmed(&'a self) -> DimDisplay<'a, Self>
pub fn italic(&'a self) -> ItalicDisplay<'a, Self>
pub fn underline(&'a self) -> UnderlineDisplay<'a, Self>
pub fn blink(&'a self) -> BlinkDisplay<'a, Self>
pub fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
pub fn reversed(&'a self) -> ReversedDisplay<'a, Self>
pub fn hidden(&'a self) -> HiddenDisplay<'a, Self>
pub fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
pub fn color<Color>(
&'a self,
color: Color
) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
&'a self,
color: Color
) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
pub fn on_color<Color>(
&'a self,
color: Color
) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
&'a self,
color: Color
) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
pub fn truecolor(
&'a self,
r: u8,
g: u8,
b: u8
) -> FgDynColorDisplay<'a, Rgb, Self>
&'a self,
r: u8,
g: u8,
b: u8
) -> FgDynColorDisplay<'a, Rgb, Self>
pub fn on_truecolor(
&'a self,
r: u8,
g: u8,
b: u8
) -> BgDynColorDisplay<'a, Rgb, Self>
&'a self,
r: u8,
g: u8,
b: u8
) -> BgDynColorDisplay<'a, Rgb, Self>
pub fn style(&self, style: Style) -> Styled<&Self>
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,