pub struct PathArg<'a>(pub &'a str);Expand description
PathArg is a path argument, written either as a spec path or as a
filesystem path (CLI-1_AC-7, CLI-1_AC-8).
Tuple Fields§
§0: &'a strImplementations§
Source§impl PathArg<'_>
impl PathArg<'_>
Sourcepub fn resolve(&self, root: &RepoRoot, cwd: &Path) -> Option<RepoPath>
pub fn resolve(&self, root: &RepoRoot, cwd: &Path) -> Option<RepoPath>
resolve returns the path that the argument refers to, but only when
a file or directory exists there. It first reads an argument that
begins with / as a spec path, and then as an absolute filesystem
path inside the root. It resolves any other argument from cwd. An
argument can end with / only when it refers to a directory.
Sourcepub fn resolve_new(&self, root: &RepoRoot, cwd: &Path) -> Option<RepoPath>
pub fn resolve_new(&self, root: &RepoRoot, cwd: &Path) -> Option<RepoPath>
resolve_new returns the path of a directory that might not exist
yet, as in init DIR. It resolves an existing path as resolve does.
It reads an absent path that begins with / as an absolute filesystem
path when the path starts with the path of the repository root, and as
a spec path otherwise. It resolves any other argument from cwd. The
argument can end with /, because the path is always a directory.
Trait Implementations§
impl<'a> Copy for PathArg<'a>
impl<'a> Eq for PathArg<'a>
impl<'a> StructuralPartialEq for PathArg<'a>
Auto Trait Implementations§
impl<'a> Forget for PathArg<'a>
impl<'a> Freeze for PathArg<'a>
impl<'a> Move for PathArg<'a>
impl<'a> RefUnwindSafe for PathArg<'a>
impl<'a> Send for PathArg<'a>
impl<'a> Sync for PathArg<'a>
impl<'a> Unpin for PathArg<'a>
impl<'a> UnsafeUnpin for PathArg<'a>
impl<'a> UnwindSafe for PathArg<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.