pub struct RelativePath { /* private fields */ }Expand description
A borrowed, immutable relative path.
Implementations§
Source§impl RelativePath
impl RelativePath
Sourcepub fn new<S>(s: &S) -> &RelativePath
pub fn new<S>(s: &S) -> &RelativePath
Directly wraps a string slice as a RelativePath slice.
Sourcepub fn from_path<P>(path: &P) -> Result<&RelativePath, FromPathError>
Available on crate feature std only.
pub fn from_path<P>(path: &P) -> Result<&RelativePath, FromPathError>
std only.Try to convert a Path to a RelativePath without allocating a buffer.
§Errors
This requires the path to be a legal, platform-neutral relative path.
Otherwise various forms of FromPathError will be returned as an
Err.
§Examples
use relative_path::{RelativePath, FromPathErrorKind};
assert_eq!(
Ok(RelativePath::new("foo/bar")),
RelativePath::from_path("foo/bar")
);
// Note: absolute paths are different depending on platform.
if cfg!(windows) {
let e = RelativePath::from_path("c:\\foo\\bar").unwrap_err();
assert_eq!(FromPathErrorKind::NonRelative, e.kind());
}
if cfg!(unix) {
let e = RelativePath::from_path("/foo/bar").unwrap_err();
assert_eq!(FromPathErrorKind::NonRelative, e.kind());
}Sourcepub fn display(&self) -> Display<'_>
👎Deprecated: RelativePath implements std::fmt::Display directly
pub fn display(&self) -> Display<'_>
Sourcepub fn join<P>(&self, path: P) -> RelativePathBufwhere
P: AsRef<RelativePath>,
Available on crate feature alloc only.
pub fn join<P>(&self, path: P) -> RelativePathBufwhere
P: AsRef<RelativePath>,
alloc only.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"));Sourcepub fn components(&self) -> Components<'_> ⓘ
pub fn components(&self) -> Components<'_> ⓘ
Iterate over all components in this relative path.
§Examples
use relative_path::{Component, RelativePath};
let path = RelativePath::new("foo/bar/baz");
let mut it = path.components();
assert_eq!(Some(Component::Normal("foo")), it.next());
assert_eq!(Some(Component::Normal("bar")), it.next());
assert_eq!(Some(Component::Normal("baz")), it.next());
assert_eq!(None, it.next());Sourcepub fn iter(&self) -> Iter<'_> ⓘ
pub fn iter(&self) -> Iter<'_> ⓘ
Produces an iterator over the path’s components viewed as str
slices.
For more information about the particulars of how the path is separated
into components, see components.
§Examples
use relative_path::RelativePath;
let mut it = RelativePath::new("/tmp/foo.txt").iter();
assert_eq!(it.next(), Some("tmp"));
assert_eq!(it.next(), Some("foo.txt"));
assert_eq!(it.next(), None)Sourcepub fn to_relative_path_buf(&self) -> RelativePathBuf
Available on crate feature alloc only.
pub fn to_relative_path_buf(&self) -> RelativePathBuf
alloc only.Convert to an owned RelativePathBuf.
Sourcepub fn to_path<P>(&self, base: P) -> PathBuf
Available on crate feature std only.
pub fn to_path<P>(&self, base: P) -> PathBuf
std only.Build an owned PathBuf relative to base for the current relative
path.
§Examples
use relative_path::RelativePath;
use std::path::Path;
let path = RelativePath::new("foo/bar").to_path(".");
assert_eq!(Path::new("./foo/bar"), path);
let path = RelativePath::new("foo/bar").to_path("");
assert_eq!(Path::new("foo/bar"), path);§Encoding an absolute path
Absolute paths are, in contrast to when using PathBuf::push ignored
and will be added unchanged to the buffer.
This is to preserve the probability of a path conversion failing if the relative path contains platform-specific absolute path components.
use relative_path::RelativePath;
use std::path::Path;
if cfg!(windows) {
let path = RelativePath::new("/bar/baz").to_path("foo");
assert_eq!(Path::new("foo\\bar\\baz"), path);
let path = RelativePath::new("c:\\bar\\baz").to_path("foo");
assert_eq!(Path::new("foo\\c:\\bar\\baz"), path);
}
if cfg!(unix) {
let path = RelativePath::new("/bar/baz").to_path("foo");
assert_eq!(Path::new("foo/bar/baz"), path);
let path = RelativePath::new("c:\\bar\\baz").to_path("foo");
assert_eq!(Path::new("foo/c:\\bar\\baz"), path);
}Sourcepub fn to_logical_path<P>(&self, base: P) -> PathBuf
Available on crate feature std only.
pub fn to_logical_path<P>(&self, base: P) -> PathBuf
std only.Build an owned PathBuf relative to base for the current relative
path.
This is similar to to_path except that it doesn’t just
unconditionally append one path to the other, instead it performs the
following operations depending on its own components:
Component::CurDirleaves thebaseunmodified.Component::ParentDirremoves a component frombaseusingpath::PathBuf::pop.Component::Normalpushes the given path component ontobaseusing the same mechanism asto_path.
Note that the exact semantics of the path operation is determined by the
corresponding PathBuf operation. E.g. popping a component off a path
like . will result in an empty path.
use relative_path::RelativePath;
use std::path::Path;
let path = RelativePath::new("..").to_logical_path(".");
assert_eq!(path, Path::new(""));§Examples
use relative_path::RelativePath;
use std::path::Path;
let path = RelativePath::new("..").to_logical_path("foo/bar");
assert_eq!(path, Path::new("foo"));§Encoding an absolute path
Behaves the same as to_path when encoding
absolute paths.
Absolute paths are, in contrast to when using PathBuf::push ignored
and will be added unchanged to the buffer.
This is to preserve the probability of a path conversion failing if the relative path contains platform-specific absolute path components.
use relative_path::RelativePath;
use std::path::Path;
if cfg!(windows) {
let path = RelativePath::new("/bar/baz").to_logical_path("foo");
assert_eq!(Path::new("foo\\bar\\baz"), path);
let path = RelativePath::new("c:\\bar\\baz").to_logical_path("foo");
assert_eq!(Path::new("foo\\c:\\bar\\baz"), path);
let path = RelativePath::new("foo/bar").to_logical_path("");
assert_eq!(Path::new("foo\\bar"), path);
}
if cfg!(unix) {
let path = RelativePath::new("/bar/baz").to_logical_path("foo");
assert_eq!(Path::new("foo/bar/baz"), path);
let path = RelativePath::new("c:\\bar\\baz").to_logical_path("foo");
assert_eq!(Path::new("foo/c:\\bar\\baz"), path);
let path = RelativePath::new("foo/bar").to_logical_path("");
assert_eq!(Path::new("foo/bar"), path);
}Sourcepub fn parent(&self) -> Option<&RelativePath>
pub fn parent(&self) -> Option<&RelativePath>
Returns a relative path, without its final Component if there is one.
§Examples
use relative_path::RelativePath;
assert_eq!(Some(RelativePath::new("foo")), RelativePath::new("foo/bar").parent());
assert_eq!(Some(RelativePath::new("")), RelativePath::new("foo").parent());
assert_eq!(None, RelativePath::new("").parent());Sourcepub fn file_name(&self) -> Option<&str>
pub fn file_name(&self) -> Option<&str>
Returns the final component of the RelativePath, 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.
Returns None If the path terminates in ...
§Examples
use relative_path::RelativePath;
assert_eq!(Some("bin"), RelativePath::new("usr/bin/").file_name());
assert_eq!(Some("foo.txt"), RelativePath::new("tmp/foo.txt").file_name());
assert_eq!(Some("foo.txt"), RelativePath::new("tmp/foo.txt/").file_name());
assert_eq!(Some("foo.txt"), RelativePath::new("foo.txt/.").file_name());
assert_eq!(Some("foo.txt"), RelativePath::new("foo.txt/.//").file_name());
assert_eq!(None, RelativePath::new("foo.txt/..").file_name());
assert_eq!(None, RelativePath::new("/").file_name());Sourcepub fn strip_prefix<P>(
&self,
base: P,
) -> Result<&RelativePath, StripPrefixError>where
P: AsRef<RelativePath>,
pub fn strip_prefix<P>(
&self,
base: P,
) -> Result<&RelativePath, StripPrefixError>where
P: AsRef<RelativePath>,
Returns a relative path that, when joined onto base, yields self.
§Errors
If base is not a prefix of self (i.e. starts_with returns
false), returns Err.
§Examples
use relative_path::RelativePath;
let path = RelativePath::new("test/haha/foo.txt");
assert_eq!(path.strip_prefix("test"), Ok(RelativePath::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("test").is_ok(), true);
assert_eq!(path.strip_prefix("haha").is_ok(), false);Sourcepub fn starts_with<P>(&self, base: P) -> boolwhere
P: AsRef<RelativePath>,
pub fn starts_with<P>(&self, base: P) -> boolwhere
P: AsRef<RelativePath>,
Determines whether base is a prefix of self.
Only considers whole path components to match.
§Examples
use relative_path::RelativePath;
let path = RelativePath::new("etc/passwd");
assert!(path.starts_with("etc"));
assert!(!path.starts_with("e"));Sourcepub fn ends_with<P>(&self, child: P) -> boolwhere
P: AsRef<RelativePath>,
pub fn ends_with<P>(&self, child: P) -> boolwhere
P: AsRef<RelativePath>,
Determines whether child is a suffix of self.
Only considers whole path components to match.
§Examples
use relative_path::RelativePath;
let path = RelativePath::new("etc/passwd");
assert!(path.ends_with("passwd"));Sourcepub fn is_normalized(&self) -> bool
pub fn is_normalized(&self) -> bool
Determines whether self is normalized.
§Examples
use relative_path::RelativePath;
// These are normalized.
assert!(RelativePath::new("").is_normalized());
assert!(RelativePath::new("baz.txt").is_normalized());
assert!(RelativePath::new("foo/bar/baz.txt").is_normalized());
assert!(RelativePath::new("..").is_normalized());
assert!(RelativePath::new("../..").is_normalized());
assert!(RelativePath::new("../../foo/bar/baz.txt").is_normalized());
// These are not normalized.
assert!(!RelativePath::new(".").is_normalized());
assert!(!RelativePath::new("./baz.txt").is_normalized());
assert!(!RelativePath::new("foo/..").is_normalized());
assert!(!RelativePath::new("foo/../baz.txt").is_normalized());
assert!(!RelativePath::new("foo/.").is_normalized());
assert!(!RelativePath::new("foo/./baz.txt").is_normalized());
assert!(!RelativePath::new("../foo/./bar/../baz.txt").is_normalized());Sourcepub fn with_file_name<S>(&self, file_name: S) -> RelativePathBuf
Available on crate feature alloc only.
pub fn with_file_name<S>(&self, file_name: S) -> RelativePathBuf
alloc only.Creates an owned RelativePathBuf like self but with the given file
name.
See set_file_name for more details.
§Examples
use relative_path::{RelativePath, RelativePathBuf};
let path = RelativePath::new("tmp/foo.txt");
assert_eq!(path.with_file_name("bar.txt"), RelativePathBuf::from("tmp/bar.txt"));
let path = RelativePath::new("tmp");
assert_eq!(path.with_file_name("var"), RelativePathBuf::from("var"));Sourcepub fn file_stem(&self) -> Option<&str>
pub fn file_stem(&self) -> Option<&str>
Extracts the stem (non-extension) portion of file_name.
The stem is:
None, if there is no file name;- The entire file name if there is no embedded
.; - The entire file name if the file name begins with
.and has no other.s within; - Otherwise, the portion of the file name before the final
.
§Examples
use relative_path::RelativePath;
let path = RelativePath::new("foo.rs");
assert_eq!("foo", path.file_stem().unwrap());Sourcepub fn extension(&self) -> Option<&str>
pub fn extension(&self) -> Option<&str>
Extracts the extension of file_name, if possible.
The extension is:
None, if there is no file name;None, if there is no embedded.;None, if the file name begins with.and has no other.s within;- Otherwise, the portion of the file name after the final
.
§Examples
use relative_path::RelativePath;
assert_eq!(Some("rs"), RelativePath::new("foo.rs").extension());
assert_eq!(None, RelativePath::new(".rs").extension());
assert_eq!(Some("rs"), RelativePath::new("foo.rs/.").extension());Sourcepub fn with_extension<S>(&self, extension: S) -> RelativePathBuf
Available on crate feature alloc only.
pub fn with_extension<S>(&self, extension: S) -> RelativePathBuf
alloc only.Creates an owned RelativePathBuf like self but with the given
extension.
See set_extension for more details.
§Examples
use relative_path::{RelativePath, RelativePathBuf};
let path = RelativePath::new("foo.rs");
assert_eq!(path.with_extension("txt"), RelativePathBuf::from("foo.txt"));Sourcepub fn join_normalized<P>(&self, path: P) -> RelativePathBufwhere
P: AsRef<RelativePath>,
Available on crate feature alloc only.
pub fn join_normalized<P>(&self, path: P) -> RelativePathBufwhere
P: AsRef<RelativePath>,
alloc only.Build an owned RelativePathBuf, joined with the given path and
normalized.
§Examples
use relative_path::RelativePath;
assert_eq!(
RelativePath::new("foo/baz.txt"),
RelativePath::new("foo/bar").join_normalized("../baz.txt").as_relative_path()
);
assert_eq!(
RelativePath::new("../foo/baz.txt"),
RelativePath::new("../foo/bar").join_normalized("../baz.txt").as_relative_path()
);Sourcepub fn normalize(&self) -> RelativePathBuf
Available on crate feature alloc only.
pub fn normalize(&self) -> RelativePathBuf
alloc only.Return an owned RelativePathBuf, with all non-normal components
moved to the beginning of the path.
This permits for a normalized representation of different relative components.
Normalization is a destructive operation if the path references an
actual filesystem path. An example of this is symlinks under unix, a
path like foo/../bar might reference a different location other than
./bar.
Normalization is a logical operation and does not guarantee that the constructed path corresponds to what the filesystem would do. On Linux for example symbolic links could mean that the logical path doesn’t correspond to the filesystem path.
§Examples
use relative_path::RelativePath;
assert_eq!(
"../foo/baz.txt",
RelativePath::new("../foo/./bar/../baz.txt").normalize()
);
assert_eq!(
"",
RelativePath::new(".").normalize()
);Sourcepub fn relative<P>(&self, path: P) -> RelativePathBufwhere
P: AsRef<RelativePath>,
Available on crate feature alloc only.
pub fn relative<P>(&self, path: P) -> RelativePathBufwhere
P: AsRef<RelativePath>,
alloc only.Constructs a relative path from the current path, to path.
This function will return the empty RelativePath "" if this source
contains unnamed components like .. that would have to be traversed to
reach the destination path. This is necessary since we have no way of
knowing what the names of those components are when we’re building the
new relative path.
use relative_path::RelativePath;
// Here we don't know what directories `../..` refers to, so there's no
// way to construct a path back to `bar` in the current directory from
// `../..`.
let from = RelativePath::new("../../foo/relative-path");
let to = RelativePath::new("bar");
assert_eq!("", from.relative(to));One exception to this is when two paths contains a common prefix at which point there’s no need to know what the names of those unnamed components are.
use relative_path::RelativePath;
let from = RelativePath::new("../../foo/bar");
let to = RelativePath::new("../../foo/baz");
assert_eq!("../baz", from.relative(to));
let from = RelativePath::new("../a/../../foo/bar");
let to = RelativePath::new("../../foo/baz");
assert_eq!("../baz", from.relative(to));§Examples
use relative_path::RelativePath;
assert_eq!(
"../../e/f",
RelativePath::new("a/b/c/d").relative(RelativePath::new("a/b/e/f"))
);
assert_eq!(
"../bbb",
RelativePath::new("a/../aaa").relative(RelativePath::new("b/../bbb"))
);
let a = RelativePath::new("git/relative-path");
let b = RelativePath::new("git");
assert_eq!("relative-path", b.relative(a));
assert_eq!("..", a.relative(b));
let a = RelativePath::new("foo/bar/bap/foo.h");
let b = RelativePath::new("../arch/foo.h");
assert_eq!("../../../../../arch/foo.h", a.relative(b));
assert_eq!("", b.relative(a));Trait Implementations§
Source§impl AsRef<RelativePath> for Component<'_>
AsRef<RelativePath> implementation for Component.
impl AsRef<RelativePath> for Component<'_>
AsRef<RelativePath> implementation for Component.
§Examples
use relative_path::RelativePath;
let mut it = RelativePath::new("../foo/bar").components();
let a = it.next().ok_or("a")?;
let b = it.next().ok_or("b")?;
let c = it.next().ok_or("c")?;
let a: &RelativePath = a.as_ref();
let b: &RelativePath = b.as_ref();
let c: &RelativePath = c.as_ref();
assert_eq!(a, "..");
assert_eq!(b, "foo");
assert_eq!(c, "bar");
Source§fn as_ref(&self) -> &RelativePath
fn as_ref(&self) -> &RelativePath
Source§impl AsRef<RelativePath> for RelativePath
impl AsRef<RelativePath> for RelativePath
Source§fn as_ref(&self) -> &RelativePath
fn as_ref(&self) -> &RelativePath
Source§impl AsRef<RelativePath> for RelativePathBuf
Available on crate feature alloc only.
impl AsRef<RelativePath> for RelativePathBuf
alloc only.Source§fn as_ref(&self) -> &RelativePath
fn as_ref(&self) -> &RelativePath
Source§impl AsRef<RelativePath> for String
Available on crate feature alloc only.AsRef<RelativePath> implementation for String.
impl AsRef<RelativePath> for String
alloc only.AsRef<RelativePath> implementation for String.
§Examples
use relative_path::RelativePath;
let path: String = format!("foo/bar");
let path: &RelativePath = path.as_ref();
assert_eq!(path, "foo/bar");Source§fn as_ref(&self) -> &RelativePath
fn as_ref(&self) -> &RelativePath
Source§impl AsRef<RelativePath> for str
AsRef<RelativePath> implementation for str.
impl AsRef<RelativePath> for str
AsRef<RelativePath> implementation for str.
§Examples
use relative_path::RelativePath;
let path: &RelativePath = "foo/bar".as_ref();
assert_eq!(path, RelativePath::new("foo/bar"));Source§fn as_ref(&self) -> &RelativePath
fn as_ref(&self) -> &RelativePath
Source§impl AsRef<str> for RelativePath
Available on crate feature alloc only.
impl AsRef<str> for RelativePath
alloc only.Source§impl Borrow<RelativePath> for RelativePathBuf
Available on crate feature alloc only.
impl Borrow<RelativePath> for RelativePathBuf
alloc only.Source§fn borrow(&self) -> &RelativePath
fn borrow(&self) -> &RelativePath
Source§impl Clone for Box<RelativePath>
Available on crate feature alloc only.Clone implementation for Box<RelativePath>.
impl Clone for Box<RelativePath>
alloc only.Clone implementation for Box<RelativePath>.
§Examples
use relative_path::RelativePath;
let path: Box<RelativePath> = RelativePath::new("foo/bar").into();
let path2 = path.clone();
assert_eq!(&*path, &*path2);Source§impl Debug for RelativePath
impl Debug for RelativePath
Source§impl<'de: 'a, 'a> Deserialize<'de> for &'a RelativePath
Available on crate feature serde only.serde::de::Deserialize implementation for a RelativePath reference.
impl<'de: 'a, 'a> Deserialize<'de> for &'a RelativePath
serde only.serde::de::Deserialize implementation for a RelativePath reference.
use serde::Deserialize;
use relative_path::RelativePath;
#[derive(Deserialize)]
struct Document<'a> {
#[serde(borrow)]
path: &'a RelativePath,
}Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserialize<'de> for Box<RelativePath>
Available on crate features alloc and serde only.serde::de::Deserialize implementation for Box<RelativePath>.
impl<'de> Deserialize<'de> for Box<RelativePath>
alloc and serde only.serde::de::Deserialize implementation for Box<RelativePath>.
use serde::Deserialize;
use relative_path::RelativePath;
#[derive(Deserialize)]
struct Document {
path: Box<RelativePath>,
}Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for RelativePath
impl Display for RelativePath
Source§impl From<&RelativePath> for Arc<RelativePath>
Available on crate feature alloc only.Conversion from RelativePath to Arc<RelativePath>.
impl From<&RelativePath> for Arc<RelativePath>
alloc only.Conversion from RelativePath to Arc<RelativePath>.
§Examples
use std::sync::Arc;
use relative_path::RelativePath;
let path: Arc<RelativePath> = RelativePath::new("foo/bar").into();
assert_eq!(&*path, "foo/bar");Source§fn from(path: &RelativePath) -> Arc<RelativePath>
fn from(path: &RelativePath) -> Arc<RelativePath>
Source§impl<'a> From<&'a RelativePath> for Cow<'a, RelativePath>
Available on crate feature alloc only.
impl<'a> From<&'a RelativePath> for Cow<'a, RelativePath>
alloc only.Source§fn from(s: &'a RelativePath) -> Cow<'a, RelativePath>
fn from(s: &'a RelativePath) -> Cow<'a, RelativePath>
Source§impl From<&RelativePath> for Rc<RelativePath>
Available on crate feature alloc only.Conversion from RelativePathBuf to Rc<RelativePath>.
impl From<&RelativePath> for Rc<RelativePath>
alloc only.Conversion from RelativePathBuf to Rc<RelativePath>.
§Examples
use std::rc::Rc;
use relative_path::RelativePath;
let path: Rc<RelativePath> = RelativePath::new("foo/bar").into();
assert_eq!(&*path, "foo/bar");Source§fn from(path: &RelativePath) -> Rc<RelativePath>
fn from(path: &RelativePath) -> Rc<RelativePath>
Source§impl<T> From<&T> for Box<RelativePath>
Available on crate feature alloc only.Conversion from a str reference to a Box<RelativePath>.
impl<T> From<&T> for Box<RelativePath>
alloc only.Conversion from a str reference to a Box<RelativePath>.
§Examples
use relative_path::RelativePath;
let path: Box<RelativePath> = "foo/bar".into();
assert_eq!(&*path, "foo/bar");
let path: Box<RelativePath> = RelativePath::new("foo/bar").into();
assert_eq!(&*path, "foo/bar");Source§impl From<Box<str>> for Box<RelativePath>
Available on crate feature alloc only.Conversion from a Box<str> reference to a Box<RelativePath>.
impl From<Box<str>> for Box<RelativePath>
alloc only.Conversion from a Box<str> reference to a Box<RelativePath>.
§Examples
use relative_path::RelativePath;
let path: Box<RelativePath> = Box::<str>::from("foo/bar").into();
assert_eq!(&*path, "foo/bar");Source§impl From<RelativePathBuf> for Box<RelativePath>
Available on crate feature alloc only.Conversion from RelativePathBuf to Box<RelativePath>.
impl From<RelativePathBuf> for Box<RelativePath>
alloc only.Conversion from RelativePathBuf to Box<RelativePath>.
§Examples
use std::sync::Arc;
use relative_path::{RelativePath, RelativePathBuf};
let path = RelativePathBuf::from("foo/bar");
let path: Box<RelativePath> = path.into();
assert_eq!(&*path, "foo/bar");Source§fn from(path: RelativePathBuf) -> Box<RelativePath>
fn from(path: RelativePathBuf) -> Box<RelativePath>
Source§impl Hash for RelativePath
impl Hash for RelativePath
Source§impl<'a> IntoIterator for &'a RelativePath
impl<'a> IntoIterator for &'a RelativePath
Source§impl Ord for RelativePath
impl Ord for RelativePath
Source§impl<'a, 'b> PartialEq<&'b RelativePath> for Cow<'a, RelativePath>
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<&'b RelativePath> for Cow<'a, RelativePath>
alloc only.Source§impl<'a, 'b> PartialEq<&'a RelativePath> for RelativePathBuf
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<&'a RelativePath> for RelativePathBuf
alloc only.Source§impl<'a, 'b> PartialEq<&'a RelativePath> for String
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<&'a RelativePath> for String
alloc only.Source§impl<'a, 'b> PartialEq<&'a RelativePath> for str
impl<'a, 'b> PartialEq<&'a RelativePath> for str
Source§impl<'a, 'b> PartialEq<&'a str> for RelativePath
impl<'a, 'b> PartialEq<&'a str> for RelativePath
Source§impl<'a, 'b> PartialEq<Cow<'a, RelativePath>> for &'b RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<Cow<'a, RelativePath>> for &'b RelativePath
alloc only.Source§impl<'a, 'b> PartialEq<Cow<'a, RelativePath>> for RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<Cow<'a, RelativePath>> for RelativePath
alloc only.Source§impl<'a, 'b> PartialEq<RelativePath> for &'a str
impl<'a, 'b> PartialEq<RelativePath> for &'a str
Source§impl<'a, 'b> PartialEq<RelativePath> for Cow<'a, RelativePath>
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<RelativePath> for Cow<'a, RelativePath>
alloc only.Source§impl<'a, 'b> PartialEq<RelativePath> for RelativePathBuf
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<RelativePath> for RelativePathBuf
alloc only.Source§impl<'a, 'b> PartialEq<RelativePath> for String
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<RelativePath> for String
alloc only.Source§impl<'a, 'b> PartialEq<RelativePath> for str
impl<'a, 'b> PartialEq<RelativePath> for str
Source§impl<'a, 'b> PartialEq<RelativePathBuf> for &'a RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<RelativePathBuf> for &'a RelativePath
alloc only.Source§impl<'a, 'b> PartialEq<RelativePathBuf> for RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<RelativePathBuf> for RelativePath
alloc only.Source§impl<'a, 'b> PartialEq<String> for &'a RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<String> for &'a RelativePath
alloc only.Source§impl<'a, 'b> PartialEq<String> for RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialEq<String> for RelativePath
alloc only.Source§impl<'a, 'b> PartialEq<str> for &'a RelativePath
impl<'a, 'b> PartialEq<str> for &'a RelativePath
Source§impl<'a, 'b> PartialEq<str> for RelativePath
impl<'a, 'b> PartialEq<str> for RelativePath
Source§impl PartialEq for RelativePath
impl PartialEq for RelativePath
Source§impl<'a, 'b> PartialOrd<&'b RelativePath> for Cow<'a, RelativePath>
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<&'b RelativePath> for Cow<'a, RelativePath>
alloc only.Source§impl<'a, 'b> PartialOrd<&'a RelativePath> for RelativePathBuf
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<&'a RelativePath> for RelativePathBuf
alloc only.Source§impl<'a, 'b> PartialOrd<&'a RelativePath> for String
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<&'a RelativePath> for String
alloc only.Source§impl<'a, 'b> PartialOrd<&'a RelativePath> for str
impl<'a, 'b> PartialOrd<&'a RelativePath> for str
Source§impl<'a, 'b> PartialOrd<&'a str> for RelativePath
impl<'a, 'b> PartialOrd<&'a str> for RelativePath
Source§impl<'a, 'b> PartialOrd<Cow<'a, RelativePath>> for &'b RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<Cow<'a, RelativePath>> for &'b RelativePath
alloc only.Source§impl<'a, 'b> PartialOrd<Cow<'a, RelativePath>> for RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<Cow<'a, RelativePath>> for RelativePath
alloc only.Source§impl<'a, 'b> PartialOrd<RelativePath> for &'a str
impl<'a, 'b> PartialOrd<RelativePath> for &'a str
Source§impl<'a, 'b> PartialOrd<RelativePath> for Cow<'a, RelativePath>
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<RelativePath> for Cow<'a, RelativePath>
alloc only.Source§impl<'a, 'b> PartialOrd<RelativePath> for RelativePathBuf
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<RelativePath> for RelativePathBuf
alloc only.Source§impl<'a, 'b> PartialOrd<RelativePath> for String
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<RelativePath> for String
alloc only.Source§impl<'a, 'b> PartialOrd<RelativePath> for str
impl<'a, 'b> PartialOrd<RelativePath> for str
Source§impl<'a, 'b> PartialOrd<RelativePathBuf> for &'a RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<RelativePathBuf> for &'a RelativePath
alloc only.Source§impl<'a, 'b> PartialOrd<RelativePathBuf> for RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<RelativePathBuf> for RelativePath
alloc only.Source§impl<'a, 'b> PartialOrd<String> for &'a RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<String> for &'a RelativePath
alloc only.Source§impl<'a, 'b> PartialOrd<String> for RelativePath
Available on crate feature alloc only.
impl<'a, 'b> PartialOrd<String> for RelativePath
alloc only.Source§impl<'a, 'b> PartialOrd<str> for &'a RelativePath
impl<'a, 'b> PartialOrd<str> for &'a RelativePath
Source§impl<'a, 'b> PartialOrd<str> for RelativePath
impl<'a, 'b> PartialOrd<str> for RelativePath
Source§impl PartialOrd for RelativePath
impl PartialOrd for RelativePath
Source§impl Serialize for RelativePath
Available on crate feature serde only.serde::ser::Serialize implementation for RelativePath.
impl Serialize for RelativePath
serde only.serde::ser::Serialize implementation for RelativePath.
use serde::Serialize;
use relative_path::RelativePath;
#[derive(Serialize)]
struct Document<'a> {
path: &'a RelativePath,
}Source§impl ToOwned for RelativePath
Available on crate feature alloc only.ToOwned implementation for RelativePath.
impl ToOwned for RelativePath
alloc only.ToOwned implementation for RelativePath.
§Examples
use relative_path::RelativePath;
let path = RelativePath::new("foo/bar").to_owned();
assert_eq!(path, "foo/bar");