Struct Path

Source
pub struct Path(/* private fields */);
Expand description

A borrowed path type. The implementation is very similar to the standard library’s std::path::Path. However, this implementation is more lightweight and allows for std-less usage.

Implementations§

Source§

impl Path

Source

pub const ROOT: &'static Path

Source

pub const EMPTY: &'static Path

Source

pub const SYSTEM: &'static Path

Contains the OS core, including the kernel, init system, and critical drivers. Prevents modification by regular users.

Source

pub const DEVICES: &'static Path

Stores system-wide settings in a structured format (e.g., JSON, TOML).

Source

pub const CONFIGURATION: &'static Path

Hardware devices, symlinks for human-friendly names.

Source

pub const SHARED_CONFIGURATION: &'static Path

Contains the shared configurations between applications.

Source

pub const DATA: &'static Path

Binaries data.

Source

pub const SHARED_DATA: &'static Path

Shared data between binaries.

Source

pub const BINARIES: &'static Path

Contains the system’s binaries, including the shell and other executables.

Source

pub const USERS: &'static Path

Contains the user’s data, including documents, downloads, and other files.

Source

pub const TEMPORARY: &'static Path

Contains temporary files, including logs and caches.

Source

pub const LOGS: &'static Path

Contains logs, including system logs and application logs.

Source

pub const fn from_str(path: &str) -> &Path

§Safety

The caller must ensure that the string is a valid path string.

Source

pub fn new<S: AsRef<str> + ?Sized>(path: &S) -> &Path

§Safety

The caller must ensure that the string is a valid path string.

Source

pub fn is_valid(&self) -> bool

Source

pub fn is_absolute(&self) -> bool

Source

pub fn is_root(&self) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_canonical(&self) -> bool

Source

pub fn go_parent(&self) -> Option<&Path>

Source

pub fn get_file_prefix(&self) -> Option<&str>

Source

pub fn get_file_name(&self) -> Option<&str>

Source

pub fn get_extension(&self) -> Option<&str>

Source

pub fn set_extension(&self, extension: &str) -> Option<PathOwned>

Source

pub fn strip_prefix<'b>(&'b self, path_prefix: &Path) -> Option<&'b Path>

Source

pub fn strip_prefix_absolute<'b>( &'b self, path_prefix: &Path, ) -> Option<&'b Path>

Source

pub fn strip_suffix<'b>(&'b self, path_suffix: &Path) -> Option<&'b Path>

Source

pub fn get_components(&self) -> Components<'_>

Source

pub fn join(&self, path: &Path) -> Option<PathOwned>

Source

pub fn append(&self, path: &str) -> Option<PathOwned>

Source

pub fn get_length(&self) -> usize

Source

pub fn as_str(&self) -> &str

Trait Implementations§

Source§

impl AsRef<Path> for Path

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Path> for PathOwned

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Path> for str

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<str> for &Path

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<Path> for PathOwned

Source§

fn borrow(&self) -> &Path

Immutably borrows from an owned value. Read more
Source§

impl Debug for Path

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Path

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl PartialEq for Path

Source§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToOwned for Path

Source§

type Owned = PathOwned

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl Eq for Path

Source§

impl StructuralPartialEq for Path

Auto Trait Implementations§

§

impl Freeze for Path

§

impl RefUnwindSafe for Path

§

impl Send for Path

§

impl !Sized for Path

§

impl Sync for Path

§

impl Unpin for Path

§

impl UnwindSafe for Path

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more