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
impl PlPath
pub fn as_str(&self) -> &str
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_os_str(&self) -> &OsStr
pub fn as_std_path(&self) -> &Path
pub fn to_ref_path(&self) -> PlRefPath
pub fn scheme(&self) -> Option<CloudScheme>
Sourcepub fn has_scheme(&self) -> bool
pub fn has_scheme(&self) -> bool
Shorthand for self.scheme().is_some().
Sourcepub fn strip_scheme(&self) -> &str
pub fn strip_scheme(&self) -> &str
Return a string with the scheme prefix removed (if any).
pub fn file_name(&self) -> Option<&OsStr>
pub fn extension(&self) -> Option<&str>
pub fn parent(&self) -> Option<&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).
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,
iwill simply be the length of the string.- This is except if the scheme is
FileNoHostname, where insteadiwill be “file:”.len()
- This is except if the scheme is
- If
selfhas noCloudScheme, returns 0
pub fn to_absolute_path(&self) -> PolarsResult<PlRefPath>
pub fn join(&self, other: impl AsRef<str>) -> PlRefPath
Sourcepub fn normalize_windows_path(path_str: &str) -> Option<PlRefPath>
pub fn normalize_windows_path(path_str: &str) -> Option<PlRefPath>
Converts backslashes to forward-slashes, and removes \\?\ prefix.
Trait Implementations§
Source§impl PartialOrd for PlPath
impl PartialOrd for PlPath
Source§impl ToOwned for PlPath
impl ToOwned for PlPath
impl Eq for PlPath
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> 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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.