pub enum RepoSource {
Local(PathBuf),
Remote {
url: String,
cache_path: PathBuf,
},
}Expand description
Repository source — local path or remote URL.
Variants§
Implementations§
Source§impl RepoSource
impl RepoSource
Sourcepub fn parse(input: &str) -> Self
pub fn parse(input: &str) -> Self
Parse a source from a string.
Automatically determines URL vs local path.
Sourcepub fn is_git_url(input: &str) -> bool
pub fn is_git_url(input: &str) -> bool
Check whether a string looks like a git URL.
Sourcepub fn compute_cache_path(url: &str) -> PathBuf
pub fn compute_cache_path(url: &str) -> PathBuf
Compute the cache path for a remote URL.
Sourcepub fn local_path(&self) -> &Path
pub fn local_path(&self) -> &Path
Local working path.
Sourcepub fn remote_url(&self) -> Option<&str>
pub fn remote_url(&self) -> Option<&str>
Remote URL (if available).
Sourcepub fn is_git_repo(&self) -> bool
pub fn is_git_repo(&self) -> bool
Is it a valid git repository?
Sourcepub async fn ensure_available(&self, branch: &str) -> Result<PathBuf>
pub async fn ensure_available(&self, branch: &str) -> Result<PathBuf>
Ensure the repository is available locally.
For local — checks existence. For remote — clones if needed.
§Errors
Returns an error if clone fails or the local path is missing.
Sourcepub async fn ensure_available_at(
&self,
branch: &str,
target: &Path,
) -> Result<PathBuf>
pub async fn ensure_available_at( &self, branch: &str, target: &Path, ) -> Result<PathBuf>
Ensure the repository is available at an explicit target path.
For local sources the target is ignored and the repository path is validated. For remote sources the target is the clone/cache directory.
§Errors
Returns an error if clone/fetch fails or the local path is missing.
Trait Implementations§
Source§impl Clone for RepoSource
impl Clone for RepoSource
Source§fn clone(&self) -> RepoSource
fn clone(&self) -> RepoSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RepoSource
impl Debug for RepoSource
Auto Trait Implementations§
impl Freeze for RepoSource
impl RefUnwindSafe for RepoSource
impl Send for RepoSource
impl Sync for RepoSource
impl Unpin for RepoSource
impl UnsafeUnpin for RepoSource
impl UnwindSafe for RepoSource
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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