pub struct PackageMetadata<'g> { /* private fields */ }
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 unique identifier for this package.

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.

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.

Returns the direct PackageLink between self and other in the specified direction:

  • Forward: from self to other
  • Reverse: from other to self

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.

This is supported on crate feature summaries only.

Converts this metadata to a SummaryId.

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

PackageMetadata’s PartialEq implementation uses pointer equality for the PackageGraph.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. 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.