pub enum PackageSource {
Path(PathBuf),
Git {
url: Url,
git_ref: GitReference,
},
RemoteRegistry(Url),
LocalRegistry(PathBuf),
CratesIo,
}Expand description
Defines a source from which a package can be fetched.
This enum can either be constructed manually, or with associated helper functions on it.
Variants§
Path(PathBuf)
Path source:
dep = { path = "some/local/dependency" }Git
Git source:
regex = { git = "https://github.com/rust-lang/regex", branch = "next" }RemoteRegistry(Url)
Remote registry:
some-crate = { version = "1.0", registry = "my-registry" }LocalRegistry(PathBuf)
Local registry:
some-crate = { version = "1.0", registry = "my-local-registry" }CratesIo
crates.io:
foo = "1.0.0"Note that this does not respect .cargo/config.toml, so if default-registry or crates-io
are overriden, this would still fetch from crates.io
Implementations§
Source§impl PackageSource
impl PackageSource
Sourcepub fn path<P: Into<PathBuf>>(path: P) -> Result<Self, String>
pub fn path<P: Into<PathBuf>>(path: P) -> Result<Self, String>
Constructs a new PackageSource::Path from path.
Sourcepub fn git<U: AsRef<str>>(
url: U,
git_ref: Option<GitReference>,
) -> Result<Self, <Url as FromStr>::Err>
pub fn git<U: AsRef<str>>( url: U, git_ref: Option<GitReference>, ) -> Result<Self, <Url as FromStr>::Err>
Constructs a new PackageSource::Git from repository url and an optional GitReference, if None is provided, GitReference::DefaultBranch will be assumed.
Sourcepub fn remote<U: TryInto<Url>>(url: U) -> Result<Self, U::Error>
pub fn remote<U: TryInto<Url>>(url: U) -> Result<Self, U::Error>
Constructs a new PackageSource::RemoteRegistry from a registry index url.
Sourcepub fn local<P: Into<PathBuf>>(path: P) -> Self
pub fn local<P: Into<PathBuf>>(path: P) -> Self
Constructs a new PackageSource::LocalRegistry from a registry index path.
Sourcepub fn crates_io() -> Self
pub fn crates_io() -> Self
Returns PackageSource::CratesIo.
Trait Implementations§
Source§impl Clone for PackageSource
impl Clone for PackageSource
Source§fn clone(&self) -> PackageSource
fn clone(&self) -> PackageSource
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 PackageSource
impl Debug for PackageSource
impl Eq for PackageSource
Source§impl PartialEq for PackageSource
impl PartialEq for PackageSource
impl StructuralPartialEq for PackageSource
Auto Trait Implementations§
impl Freeze for PackageSource
impl RefUnwindSafe for PackageSource
impl Send for PackageSource
impl Sync for PackageSource
impl Unpin for PackageSource
impl UnsafeUnpin for PackageSource
impl UnwindSafe for PackageSource
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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