pub struct DvsPaths { /* private fields */ }Expand description
We always need to figure out where the user is in a project, where the root is etc. This struct handles all of it so the rest of the code doesn’t have to
Implementations§
Source§impl DvsPaths
impl DvsPaths
Sourcepub fn new(
cwd: PathBuf,
repo_root: PathBuf,
metadata_folder_name: impl Into<String>,
) -> Result<Self>
pub fn new( cwd: PathBuf, repo_root: PathBuf, metadata_folder_name: impl Into<String>, ) -> Result<Self>
Create with explicit paths (for testing or R package)
pub fn from_cwd(config: &Config) -> Result<Self>
pub fn metadata_folder(&self) -> PathBuf
pub fn cache_folder(&self) -> PathBuf
pub fn metadata_path(&self, relative: &Path) -> PathBuf
pub fn repo_root(&self) -> &Path
pub fn cwd(&self) -> &Path
Sourcepub fn cwd_relative_to_root(&self) -> Option<&Path>
pub fn cwd_relative_to_root(&self) -> Option<&Path>
Get the path relative from repo root to cwd, or None if at repo root
Sourcepub fn file_path(&self, relative: &Path) -> PathBuf
pub fn file_path(&self, relative: &Path) -> PathBuf
Construct the full file path from a repo-relative path
pub fn validate_for_add( &self, paths: &[PathBuf], ) -> Vec<(PathBuf, AddPathStatus)>
pub fn validate_for_get( &self, paths: &[PathBuf], ) -> Vec<(PathBuf, GetPathStatus)>
Trait Implementations§
impl Eq for DvsPaths
impl StructuralPartialEq for DvsPaths
Auto Trait Implementations§
impl Freeze for DvsPaths
impl RefUnwindSafe for DvsPaths
impl Send for DvsPaths
impl Sync for DvsPaths
impl Unpin for DvsPaths
impl UnsafeUnpin for DvsPaths
impl UnwindSafe for DvsPaths
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
Mutably borrows from an owned value. Read more
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more