pub enum PackageSource<'g> {
    Workspace(&'g Utf8Path),
    Path(&'g Utf8Path),
    External(&'g str),
}
Expand description

The source of a package.

This enum contains information about where a package is found, and whether it is inside or outside the workspace.

Variants§

§

Workspace(&'g Utf8Path)

This package is in the workspace.

The path is relative to the workspace root.

§

Path(&'g Utf8Path)

This package is a path dependency that isn’t in the workspace.

The path is relative to the workspace root.

§

External(&'g str)

This package is an external dependency.

  • For packages retrieved from crates.io, the source is the string "registry+https://github.com/rust-lang/crates.io-index".
  • For packages retrieved from other registries, the source begins with "registry+".
  • For packages retrieved from Git repositories, the source begins with "git+".

Implementations§

The path to the crates.io registry.

Returns true if this package source represents a workspace.

Returns true if this package source represents a path dependency that isn’t in the workspace.

Returns true if this package source represents an external dependency.

Returns true if the source is crates.io.

Returns true if this package is a local dependency, i.e. either in the workspace or a local path.

Returns the path if this is a workspace dependency, or None if this is a non-workspace dependency.

The path is relative to the workspace root.

Returns the local path if this is a local dependency, or None if it is an external dependency.

The path is relative to the workspace root.

Returns the external source if this is an external dependency, or None if it is a local dependency.

Attempts to parse an external source.

Returns None if the external dependency could not be recognized, or if it is a local dependency.

For more about external sources, see the documentation for ExternalSource.

Available on crate feature summaries only.

Converts a PackageSource into a SummarySource.

Requires the summaries feature to be enabled.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.