Struct guppy::graph::PackageMetadata [−][src]
pub struct PackageMetadata<'g> { /* fields omitted */ }
Expand description
Information about a specific package in a PackageGraph
.
Most of the metadata is extracted from Cargo.toml
files. See
the Cargo.toml
reference for more
details.
Implementations
Returns the package graph this PackageMetadata
is derived from.
Creates a PackageQuery
consisting of this package, in the given direction.
The PackageQuery
can be used to inspect dependencies in this graph.
Creates a PackageSet
consisting of just this package.
pub fn direct_links_directed(
&self,
direction: DependencyDirection
) -> impl Iterator<Item = PackageLink<'g>> + 'g
pub fn direct_links_directed(
&self,
direction: DependencyDirection
) -> impl Iterator<Item = PackageLink<'g>> + 'g
Returns PackageLink
instances corresponding to the direct dependencies for this package in
the specified direction.
Returns PackageLink
instances corresponding to the direct dependencies for this package.
Returns PackageLink
instances corresponding to the packages that directly depend on this
one.
pub fn link_between(
&self,
other: &PackageId,
direction: DependencyDirection
) -> Result<Option<PackageLink<'g>>, Error>
pub fn link_between(
&self,
other: &PackageId,
direction: DependencyDirection
) -> Result<Option<PackageLink<'g>>, Error>
Returns the direct PackageLink
between self
and other
in the specified direction:
Forward
: fromself
toother
Reverse
: fromother
toself
Returns None
if the direct link does not exist, or an error if to
isn’t found in
self.graph()
.
Returns the direct PackageLink
from self
to the specified package, or None
if self
does not directly depend on the specified package.
Returns an error if to
isn’t found in self.graph()
.
Returns the direct PackageLink
from the specified package to self
, or None
if the
specified package does not directly depend on self
.
Returns an error if from
isn’t found in self.graph()
.
Returns the name of this package.
This is the same as the name
field of Cargo.toml
.
Returns the version of this package as resolved by Cargo.
This is the same as the version
field of Cargo.toml
.
Returns the authors of this package.
This is the same as the authors
field of Cargo.toml
.
Returns a short description for this package.
This is the same as the description
field of Cargo.toml
.
Returns an SPDX 2.1 license expression for this package, if specified.
This is the same as the license
field of Cargo.toml
. Note that guppy
does not perform
any validation on this, though crates.io
does if a crate is uploaded there.
Returns the path to a license file for this package, if specified.
This is the same as the license_file
field of Cargo.toml
. It is typically only specified
for nonstandard licenses.
Returns the source from which this package was retrieved.
This may be the workspace path, an external path, or a registry like crates.io
.
Returns true if this package is in the workspace.
For more detailed information, use source()
.
Returns the full path to the Cargo.toml
for this package.
This is specific to the system that cargo metadata
was run on.
Returns categories for this package.
This is the same as the categories
field of Cargo.toml
. For packages on crates.io
,
returned values are guaranteed to be
valid category slugs.
Returns keywords for this package.
This is the same as the keywords
field of Cargo.toml
.
Returns a path to the README for this package, if specified.
This is the same as the readme
field of Cargo.toml
. The path returned is relative to the
directory the Cargo.toml
is in (i.e. relative to the parent of self.manifest_path()
).
Returns the source code repository for this package, if specified.
This is the same as the repository
field of Cargo.toml
.
Returns the homepage for this package, if specified.
This is the same as the homepage
field of Cargo.toml
.
Returns the documentation URL for this package, if specified.
This is the same as the homepage
field of Cargo.toml
.
Returns the Rust edition this package is written against.
This is the same as the edition
field of Cargo.toml
. It is "2015"
by default.
Returns the freeform metadata table for this package.
This is the same as the package.metadata
section of Cargo.toml
. This section is
typically used by tools which would like to store package configuration in Cargo.toml
.
Returns the name of a native library this package links to, if specified.
This is the same as the links
field of Cargo.toml
. See The links
Manifest
Key in
the Cargo book for more details.
Returns the registries to which this package may be published.
This is derived from the publish
field of Cargo.toml
.
Returns the binary that is run by default, if specified.
Information about this binary can be queried using the build_target
method.
This is derived from the default-run
field of Cargo.toml
.
Returns the minimal Rust compiler version, which should be able to compile the package, if specified.
This is the same as the rust-version
field of Cargo.toml
. For more, see the
rust-version
field
in the Cargo reference.
Returns all the build targets for this package.
For more, see Cargo Targets in the Cargo reference.
Looks up a build target by identifier.
Returns true if this package is a procedural macro.
For more about procedural macros, see Procedural Macros in the Rust reference.
Returns true if this package has a build script.
Cargo only follows build dependencies if a build script is set.
For more about build scripts, see Build Scripts in the Cargo reference.
Returns true if this package has a named feature named default
.
For more about default features, see The [features]
section in
the Cargo reference.
Returns the FeatureId
corresponding to the default feature.
Returns the list of named features available for this package. This will include a feature named “default” if it is defined.
A named feature is listed in the [features]
section of Cargo.toml
. For more, see
the reference.
Trait Implementations
PackageMetadata
’s PartialEq
implementation uses pointer equality for the PackageGraph
.
Auto Trait Implementations
impl<'g> RefUnwindSafe for PackageMetadata<'g>
impl<'g> Send for PackageMetadata<'g>
impl<'g> Sync for PackageMetadata<'g>
impl<'g> Unpin for PackageMetadata<'g>
impl<'g> UnwindSafe for PackageMetadata<'g>
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.