ParsablePath

Trait ParsablePath 

Source
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§

Source

const PRIMARY_COMPONENT_SEPARATOR: char

The primary component separator.

For example, '/' on Posix systems and '\\' on Windows.

Source

const SECONDARY_COMPONENT_SEPARATOR: Option<char>

The secondary component separator.

For example, None on Posix systems and Some('/') on Windows.

Source

const EXTENSION_SEPARATOR: char

The extension separator.

Source

const DRIVE_SEPARATOR: Option<char>

The drive separator.

Provided Associated Constants§

Source

const COMPONENT_SEPARATORS: &'static [char] = _

The component separators.

For example, &['/', '\\'] on Windows.

Required Methods§

Source

fn as_string_mut(&mut self) -> &mut String

Returns a mutable reference to the path as a string.

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

fn split_last_component( s: &str, _: bool, ) -> (Option<&str>, Option<Component<'_>>)

Returns the parent of the path and the last component of the path.

Source

fn split_last(s: &str) -> (Option<&str>, Option<&str>)

Returns the parent of the path and the last component of the path.

Source

fn parent(s: &str) -> Option<&str>

Returns the parent of the path.

Source

fn file_name(s: &str) -> Option<&str>

Returns the last component of the path, if there is one.

Source

fn join_in_place(parent: &mut String, child: &str)

Joins the given path with the parent in place.

Source

fn join(parent: &str, child: &str) -> String

Joins the given path.

Source

fn split_extension(s: &str) -> (&str, Option<&str>)

Returns the file stem and extension of the path.

Source

fn with_extension(path: &str, ext: &str) -> String

Replace the extension of the path with the given extension in place.

Source

fn split_driver(path: &str) -> (Option<&str>, &str)

Returns the driver of the path and the rest of the path.

Source

fn is_absolute(path: &str) -> bool

Returns whether the path is absolute.

Source

fn as_dir(path: &mut String)

Append component separator if not already present.

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.

Implementors§