Struct relative_path::RelativePathBuf
[−]
[src]
pub struct RelativePathBuf { /* fields omitted */ }
An owned, mutable relative path.
This type provides methods to manipulate relative path objects.
Methods
impl RelativePathBuf
[src]
fn new() -> RelativePathBuf
[src]
Create a new relative path buffer.
fn from(path: String) -> RelativePathBuf
[src]
Create a new relative path buffer from an owned string.
fn push<P: AsRef<RelativePath>>(&mut self, path: P)
[src]
Extends self
with path
.
If path
is absolute, it replaces the current path.
Examples
use relative_path::{RelativePathBuf, RelativePath}; let mut path = RelativePathBuf::new(); path.push("foo"); path.push("bar"); assert_eq!("foo/bar", path);
fn as_relative_path(&self) -> &RelativePath
[src]
Coerce to a RelativePath
slice.
Methods from Deref<Target = RelativePath>
fn join<P: AsRef<RelativePath>>(&self, path: P) -> RelativePathBuf
[src]
Creates an owned RelativePathBuf
with path adjoined to self.
Examples
use relative_path::RelativePath; let path = RelativePath::new("foo/bar"); assert_eq!("foo/bar/baz", path.join("baz"));
fn components(&self) -> Components
[src]
Iterate over all components in this relative path.
Examples
use relative_path::RelativePath; let path = RelativePath::new("foo/bar/baz"); let mut it = path.components(); assert_eq!(Some("foo"), it.next()); assert_eq!(Some("bar"), it.next()); assert_eq!(Some("baz"), it.next()); assert_eq!(None, it.next());
fn to_relative_path_buf(&self) -> RelativePathBuf
[src]
Convert to an owned RelativePathBuf
.
fn to_path<P: AsRef<Path>>(&self, relative_to: P) -> PathBuf
[src]
Build an owned PathBuf
relative to path
for the current relative path.
Examples
use relative_path::RelativePath; use std::path::Path; let path = RelativePath::new("foo/bar").to_path(Path::new(".")); assert_eq!(Path::new("./foo/bar"), path);
fn is_absolute(&self) -> bool
[src]
Check if path starts with a path separator.
fn parent(&self) -> Option<&RelativePath>
[src]
Returns a relative path, without its final component if there is one.
Examples
use relative_path::RelativePath; let path = RelativePath::new("foo/bar"); assert_eq!(Some(RelativePath::new("foo")), path.parent());
fn relativize_with<P: AsRef<RelativePath>>(&self, path: P) -> RelativePathBuf
[src]
Return a relative path, resolved from the current path.
Examples
use relative_path::RelativePath; assert_eq!( RelativePath::new("foo/baz.txt"), RelativePath::new("foo/bar").relativize_with("../baz.txt").as_relative_path() );
fn relativize(&self) -> RelativePathBuf
[src]
Return a relative path, resolved from the current path by removing all relative components.
Examples
use relative_path::RelativePath; assert_eq!( RelativePath::new("foo/baz.txt"), RelativePath::new("foo/./bar/../baz.txt").relativize().as_relative_path() );
Trait Implementations
impl Clone for RelativePathBuf
[src]
fn clone(&self) -> RelativePathBuf
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for RelativePathBuf
[src]
impl Debug for RelativePathBuf
[src]
impl AsRef<RelativePath> for RelativePathBuf
[src]
fn as_ref(&self) -> &RelativePath
[src]
Performs the conversion.
impl Borrow<RelativePath> for RelativePathBuf
[src]
fn borrow(&self) -> &RelativePath
[src]
Immutably borrows from an owned value. Read more
impl From<String> for RelativePathBuf
[src]
fn from(value: String) -> RelativePathBuf
[src]
Performs the conversion.
impl Deref for RelativePathBuf
[src]
type Target = RelativePath
The resulting type after dereferencing.
fn deref(&self) -> &RelativePath
[src]
Dereferences the value.
impl PartialEq for RelativePathBuf
[src]
fn eq(&self, other: &RelativePathBuf) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for RelativePathBuf
[src]
impl PartialOrd for RelativePathBuf
[src]
fn partial_cmp(&self, other: &RelativePathBuf) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for RelativePathBuf
[src]
fn cmp(&self, other: &RelativePathBuf) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl Hash for RelativePathBuf
[src]
fn hash<H: Hasher>(&self, h: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl AsRef<str> for RelativePathBuf
[src]
impl<'a, 'b> PartialEq<RelativePath> for RelativePathBuf
[src]
fn eq(&self, other: &RelativePath) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialOrd<RelativePath> for RelativePathBuf
[src]
fn partial_cmp(&self, other: &RelativePath) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, 'b> PartialEq<&'a RelativePath> for RelativePathBuf
[src]
fn eq(&self, other: &&'a RelativePath) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialOrd<&'a RelativePath> for RelativePathBuf
[src]
fn partial_cmp(&self, other: &&'a RelativePath) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, 'b> PartialEq<Cow<'a, RelativePath>> for RelativePathBuf
[src]
fn eq(&self, other: &Cow<'a, RelativePath>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialOrd<Cow<'a, RelativePath>> for RelativePathBuf
[src]
fn partial_cmp(&self, other: &Cow<'a, RelativePath>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, 'b> PartialEq<str> for RelativePathBuf
[src]
fn eq(&self, other: &str) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialOrd<str> for RelativePathBuf
[src]
fn partial_cmp(&self, other: &str) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, 'b> PartialEq<&'a str> for RelativePathBuf
[src]
fn eq(&self, other: &&'a str) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialOrd<&'a str> for RelativePathBuf
[src]
fn partial_cmp(&self, other: &&'a str) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, 'b> PartialEq<String> for RelativePathBuf
[src]
fn eq(&self, other: &String) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialOrd<String> for RelativePathBuf
[src]
fn partial_cmp(&self, other: &String) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more