[][src]Struct iref::Path

pub struct Path<'a> { /* fields omitted */ }

Methods

impl<'a> Path<'a>[src]

pub fn as_ref(&self) -> &[u8][src]

pub fn as_str(&self) -> &str[src]

Get the underlying path slice as a string slice.

pub fn as_pct_str(&self) -> &PctStr[src]

Get the underlying path slice as a percent-encoded string slice.

pub fn is_empty(&self) -> bool[src]

Checks if the path is empty.

Returns true if the path is `` or /.

pub fn is_absolute(&self) -> bool[src]

Checks if the path is absolute.

A path is absolute if it starts with a /. A path is necessarily absolute if the IRI it is contained in contains a non-empty authority.

pub fn is_relative(&self) -> bool[src]

Checks if the path is relative.

A path is relative if it does not start with a /. A path cannot be relative if the IRI it is contained in contains a non-empty authority.

pub fn is_open(&self) -> bool[src]

Checks if the path ends with a / but is not equal to /.

pub fn is_closed(&self) -> bool[src]

pub fn first(&self) -> Option<Segment<'a>>[src]

pub fn directory(&self) -> Path[src]

Return the path directory part.

This correspond to the path without everything after the right most /.

pub fn segments(&self) -> Segments[src]

Produces an iterator over the segments of the IRI path.

Note that this is an IRI path, not an IRI reference path: no normalization occurs with . and .. segments. This is done by the IRI reference resolution function.

Empty segments are preserved: the path a//b will raise the three segments a, and `b`. The absolute path `/` has no segments, but the path `/a/` has two segments, `a` and.

pub fn normalized_segments(&self) -> NormalizedSegments[src]

Iterate over the normalized segments of the path.

Remove the special dot segments .. and . from the iteration using the usual path semantics for dot segments. This may be expensive for large paths since it will need to internally normalize the path first.

pub fn into_normalized_segments(self) -> NormalizedSegments<'a>[src]

Consume the path reference and return an iterator over its normalized segments.

pub fn file_name(&self) -> Option<&'a str>[src]

Returns the name of the final segment of the path, if there is one.

If the path is a normal file, this is the file name. If it's the path of a directory, this is the directory name.

This does not consider the normalized version of the path, dot segments are preserved.

pub fn parent(&self) -> Option<Path<'a>>[src]

Returns the path without its final component, if there is one.

Trait Implementations

impl<'a> Clone for Path<'a>[src]

impl<'a> Copy for Path<'a>[src]

impl<'a> Debug for Path<'a>[src]

impl<'a> Display for Path<'a>[src]

impl<'a> Eq for Path<'a>[src]

impl<'a> Hash for Path<'a>[src]

impl<'a> IntoIterator for Path<'a>[src]

type Item = Segment<'a>

The type of the elements being iterated over.

type IntoIter = Segments<'a>

Which kind of iterator are we turning this into?

impl<'a> Ord for Path<'a>[src]

impl<'a> PartialEq<&'a str> for Path<'a>[src]

impl<'a> PartialEq<Path<'a>> for Path<'a>[src]

impl<'a> PartialOrd<Path<'a>> for Path<'a>[src]

impl<'a> TryFrom<&'a str> for Path<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Path<'a>

impl<'a> Send for Path<'a>

impl<'a> Sync for Path<'a>

impl<'a> Unpin for Path<'a>

impl<'a> UnwindSafe for Path<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.