pub trait ParsablePath {
const PRIMARY_COMPONENT_SEPARATOR: char;
const SECONDARY_COMPONENT_SEPARATOR: Option<char>;
const EXTENSION_SEPARATOR: char;
const DRIVE_SEPARATOR: Option<char>;
const COMPONENT_SEPARATORS: &'static [char] = _;
Show 15 methods
// Required method
fn as_string_mut(&mut self) -> &mut String;
// Provided methods
fn split_first_lexical(path: &str) -> (&str, Option<(&str, &str)>) { ... }
fn split_first_component(
s: &str,
progressed: bool,
) -> (Option<Component<'_>>, Option<&str>) { ... }
fn split_last_lexical(path: &str) -> (Option<(&str, &str)>, &str) { ... }
fn split_last_component(
s: &str,
_: bool,
) -> (Option<&str>, Option<Component<'_>>) { ... }
fn split_last(s: &str) -> (Option<&str>, Option<&str>) { ... }
fn parent(s: &str) -> Option<&str> { ... }
fn file_name(s: &str) -> Option<&str> { ... }
fn join_in_place(parent: &mut String, child: &str) { ... }
fn join(parent: &str, child: &str) -> String { ... }
fn split_extension(s: &str) -> (&str, Option<&str>) { ... }
fn with_extension(path: &str, ext: &str) -> String { ... }
fn split_driver(path: &str) -> (Option<&str>, &str) { ... }
fn is_absolute(path: &str) -> bool { ... }
fn as_dir(path: &mut String) { ... }
}Expand description
A path parser.
Required Associated Constants§
Sourceconst PRIMARY_COMPONENT_SEPARATOR: char
const PRIMARY_COMPONENT_SEPARATOR: char
The primary component separator.
For example, '/' on Posix systems and '\\' on Windows.
Sourceconst SECONDARY_COMPONENT_SEPARATOR: Option<char>
const SECONDARY_COMPONENT_SEPARATOR: Option<char>
The secondary component separator.
For example, None on Posix systems and Some('/') on Windows.
Sourceconst EXTENSION_SEPARATOR: char
const EXTENSION_SEPARATOR: char
The extension separator.
Sourceconst DRIVE_SEPARATOR: Option<char>
const DRIVE_SEPARATOR: Option<char>
The drive separator.
Provided Associated Constants§
Sourceconst COMPONENT_SEPARATORS: &'static [char] = _
const COMPONENT_SEPARATORS: &'static [char] = _
The component separators.
For example, &['/', '\\'] on Windows.
Required Methods§
Sourcefn as_string_mut(&mut self) -> &mut String
fn as_string_mut(&mut self) -> &mut String
Returns a mutable reference to the path as a string.
Provided Methods§
Sourcefn split_first_lexical(path: &str) -> (&str, Option<(&str, &str)>)
fn split_first_lexical(path: &str) -> (&str, Option<(&str, &str)>)
Returns the first component of the path and the rest of the path in a lexical way.
That means, .. and . are not resolved or even considered.
Sourcefn split_first_component(
s: &str,
progressed: bool,
) -> (Option<Component<'_>>, Option<&str>)
fn split_first_component( s: &str, progressed: bool, ) -> (Option<Component<'_>>, Option<&str>)
Returns the first component of the path and the rest of the path.
Sourcefn split_last_lexical(path: &str) -> (Option<(&str, &str)>, &str)
fn split_last_lexical(path: &str) -> (Option<(&str, &str)>, &str)
Returns the parent of the given path and the last component of the path in a lexical way.
That means, .. and . are not resolved or even considered.
Sourcefn split_last_component(
s: &str,
_: bool,
) -> (Option<&str>, Option<Component<'_>>)
fn split_last_component( s: &str, _: bool, ) -> (Option<&str>, Option<Component<'_>>)
Returns the parent of the path and the last component of the path.
Sourcefn split_last(s: &str) -> (Option<&str>, Option<&str>)
fn split_last(s: &str) -> (Option<&str>, Option<&str>)
Returns the parent of the path and the last component of the path.
Sourcefn join_in_place(parent: &mut String, child: &str)
fn join_in_place(parent: &mut String, child: &str)
Joins the given path with the parent in place.
Sourcefn split_extension(s: &str) -> (&str, Option<&str>)
fn split_extension(s: &str) -> (&str, Option<&str>)
Returns the file stem and extension of the path.
Sourcefn with_extension(path: &str, ext: &str) -> String
fn with_extension(path: &str, ext: &str) -> String
Replace the extension of the path with the given extension in place.
Sourcefn split_driver(path: &str) -> (Option<&str>, &str)
fn split_driver(path: &str) -> (Option<&str>, &str)
Returns the driver of the path and the rest of the path.
Sourcefn is_absolute(path: &str) -> bool
fn is_absolute(path: &str) -> bool
Returns whether the path is absolute.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.