Struct ra_ap_project_model::ManifestPath [−][src]
pub struct ManifestPath { /* fields omitted */ }
Expand description
More or less AbsPathBuf
with non-None parent.
We use it to store path to Cargo.toml, as we frequently use the parent dir
as a working directory to spawn various commands, and its nice to not have
to .unwrap()
everywhere.
This could have been named AbsNonRootPathBuf
, as we don’t enforce that
this stores manifest files in particular, but we only use this for manifests
at the moment in practice.
Implementations
Methods from Deref<Target = AbsPath>
Equivalent of Path::parent
for AbsPath
.
Equivalent of Path::join
for AbsPath
.
Normalize the given path:
- Removes repeated separators:
/a//b
becomes/a/b
- Removes occurrences of
.
and resolves..
. - Removes trailing slashes:
/a/b/
becomes/a/b
.
Example
let abs_path_buf = AbsPathBuf::assert("/a/../../b/.//c//".into());
let normalized = abs_path_buf.normalize();
assert_eq!(normalized, AbsPathBuf::assert("/b/c".into()));
Equivalent of Path::to_path_buf
for AbsPath
.
Equivalent of Path::strip_prefix
for AbsPath
.
Returns a relative path.
use std::fs::metadata().is_ok() instead
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
type Error = AbsPathBuf
type Error = AbsPathBuf
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for ManifestPath
impl Send for ManifestPath
impl Sync for ManifestPath
impl Unpin for ManifestPath
impl UnwindSafe for ManifestPath
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more