Struct Path

Source
pub struct Path { /* private fields */ }
Expand description

A slice of a path (akin to str).

More details about the overall approach can be found in the module documentation.

Implementations§

Source§

impl Path

Source

pub fn new<'a, P: AsRef<FsStr> + 'a>(path: P) -> &'a Self

Directly wraps a string slice as a Path slice.

This is a cost-free conversion.

§Examples
use vexide::path::Path;

Path::new("foo.txt");

You can create Paths from Strings, or even other Paths:

use alloc::string::String;
use vexide::path::Path;

let string = String::from("foo.txt");
let from_string = Path::new(&string);
let from_path = Path::new(&from_string);
assert_eq!(from_string, from_path);
Source

pub const fn as_fs_str(&self) -> &FsStr

Yields the underlying FsStr slice.

§Examples
use vexide::{path::Path, fs::FsStr};

let fs_str = Path::new("foo.txt").as_os_str();
assert_eq!(os_str, FsStr::new("foo.txt"));

Trait Implementations§

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<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 PathBuf

Source§

fn as_ref(&self) -> &Path

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

impl Borrow<Path> for PathBuf

Source§

fn borrow(&self) -> &Path

Immutably borrows from an owned value. 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 Ord for Path

Source§

fn cmp(&self, other: &Path) -> Ordering

This method returns an Ordering between self and other. 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§

const 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 PartialOrd for Path

Source§

fn partial_cmp(&self, other: &Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. 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