PlPath

Struct PlPath 

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

Path represented as a UTF-8 string.

Equality and ordering are based on the string value, which can be sensitive to duplicate separators. as_std_path() can be used to return a &std::path::Path for comparisons / API access.

Implementations§

Source§

impl PlPath

Source

pub fn as_str(&self) -> &str

Source

pub fn as_bytes(&self) -> &[u8]

Source

pub fn as_os_str(&self) -> &OsStr

Source

pub fn as_std_path(&self) -> &Path

Source

pub fn to_ref_path(&self) -> PlRefPath

Source

pub fn scheme(&self) -> Option<CloudScheme>

Source

pub fn has_scheme(&self) -> bool

Shorthand for self.scheme().is_some().

Source

pub fn strip_scheme(&self) -> &str

Return a string with the scheme prefix removed (if any).

Source

pub fn file_name(&self) -> Option<&OsStr>

Source

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

Source

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

Source

pub fn sliced(&self, range: Range<usize>) -> &PlPath

Slices the path.

Source

pub fn strip_scheme_split_authority(&self) -> Option<(&str, &str)>

Strips the scheme, then returns the authority component, and the remaining string after the authority component. This can be understood as extracting the bucket/prefix for cloud URIs.

E.g. https://user@host:port/dir/file?param=value

  • Authority: user@host:port
  • Remaining: /dir/file?param=value

Note, for local / file: URIs, the returned authority will be empty, and the remainder will be the full URI.

§Returns

(authority, remaining).

Source

pub fn authority_end_position(&self) -> usize

Returns 0 if self.scheme() is None. Otherwise, returns i such that &self.to_str()[..i] trims to the authority.

  • If there is no ‘/’, separator found, i will simply be the length of the string.
    • This is except if the scheme is FileNoHostname, where instead i will be “file:”.len()
  • If self has no CloudScheme, returns 0
Source

pub fn to_absolute_path(&self) -> PolarsResult<PlRefPath>

Source

pub fn join(&self, other: impl AsRef<str>) -> PlRefPath

Source

pub fn normalize_windows_path(path_str: &str) -> Option<PlRefPath>

Converts backslashes to forward-slashes, and removes \\?\ prefix.

Trait Implementations§

Source§

impl AsRef<OsStr> for PlPath

Source§

fn as_ref(&self) -> &OsStr

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

impl AsRef<Path> for PlPath

Source§

fn as_ref(&self) -> &Path

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

impl AsRef<str> for PlPath

Source§

fn as_ref(&self) -> &str

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

impl Borrow<PlPath> for PlRefPath

Source§

fn borrow(&self) -> &PlPath

Immutably borrows from an owned value. Read more
Source§

impl Debug for PlPath

Source§

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

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

impl Display for PlPath

Source§

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

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

impl From<&PlPath> for Box<PlPath>

Source§

fn from(value: &PlPath) -> Self

Converts to this type from the input type.
Source§

impl Hash for PlPath

Source§

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

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

impl Ord for PlPath

Source§

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

This method returns an Ordering between self and other. Read more
Source§

impl PartialEq for PlPath

Source§

fn eq(&self, other: &PlPath) -> 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 PartialOrd for PlPath

Source§

fn partial_cmp(&self, other: &PlPath) -> 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 ToOwned for PlPath

Source§

type Owned = PlRefPath

The resulting type after obtaining ownership.
Source§

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

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · 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 PlPath

Source§

impl StructuralPartialEq for PlPath

Auto Trait Implementations§

§

impl Freeze for PlPath

§

impl RefUnwindSafe for PlPath

§

impl Send for PlPath

§

impl !Sized for PlPath

§

impl Sync for PlPath

§

impl Unpin for PlPath

§

impl UnwindSafe for PlPath

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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more