Struct guppy::graph::PackageMetadata[][src]

pub struct PackageMetadata<'g> { /* fields omitted */ }

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

impl<'g> PackageMetadata<'g>[src]

pub fn id(&self) -> &'g PackageId[src]

Returns the unique identifier for this package.

pub fn to_package_query(
    &self,
    direction: DependencyDirection
) -> PackageQuery<'g>
[src]

Creates a PackageQuery consisting of this package, in the given direction.

The PackageQuery can be used to inspect dependencies in this graph.

pub fn to_package_set(&self) -> PackageSet<'g>[src]

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.

pub fn name(&self) -> &'g str[src]

Returns the name of this package.

This is the same as the name field of Cargo.toml.

pub fn version(&self) -> &'g Version[src]

Returns the version of this package as resolved by Cargo.

This is the same as the version field of Cargo.toml.

pub fn authors(&self) -> &'g [String]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Returns the authors of this package.

This is the same as the authors field of Cargo.toml.

pub fn description(&self) -> Option<&'g str>[src]

Returns a short description for this package.

This is the same as the description field of Cargo.toml.

pub fn license(&self) -> Option<&'g str>[src]

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.

pub fn license_file(&self) -> Option<&'g Utf8Path>[src]

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.

pub fn source(&self) -> PackageSource<'g>[src]

Returns the source from which this package was retrieved.

This may be the workspace path, an external path, or a registry like crates.io.

pub fn in_workspace(&self) -> bool[src]

Returns true if this package is in the workspace.

For more detailed information, use source().

pub fn manifest_path(&self) -> &'g Utf8Path[src]

Returns the full path to the Cargo.toml for this package.

This is specific to the system that cargo metadata was run on.

pub fn categories(&self) -> &'g [String]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

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.

pub fn keywords(&self) -> &'g [String]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Returns keywords for this package.

This is the same as the keywords field of Cargo.toml.

pub fn readme(&self) -> Option<&'g Path>[src]

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()).

pub fn repository(&self) -> Option<&'g str>[src]

Returns the source code repository for this package, if specified.

This is the same as the repository field of Cargo.toml.

pub fn edition(&self) -> &'g str[src]

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.

pub fn metadata_table(&self) -> &'g JsonValue[src]

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.

pub fn publish(&self) -> Option<&'g [String]>[src]

Returns the list of registries to which this package may be published.

Returns None if publishing is unrestricted, and Some(&[]) if publishing is forbidden.

This is the same as the publish field of Cargo.toml.

pub fn build_targets(&self) -> impl Iterator<Item = BuildTarget<'g>>[src]

Returns all the build targets for this package.

For more, see Cargo Targets in the Cargo reference.

pub fn build_target(&self, id: &BuildTargetId<'_>) -> Option<BuildTarget<'g>>[src]

Looks up a build target by identifier.

pub fn is_proc_macro(&self) -> bool[src]

Returns true if this package is a procedural macro.

For more about procedural macros, see Procedural Macros in the Rust reference.

pub fn has_build_script(&self) -> bool[src]

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.

pub fn has_default_feature(&self) -> bool[src]

Returns true if this package has a named feature named default.

For more about default features, see The [features] section in the Cargo reference.

pub fn default_feature_id(&self) -> FeatureId<'g>[src]

Returns the FeatureId corresponding to the default feature.

pub fn named_features(&self) -> impl Iterator<Item = &'g str> + 'g[src]

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.

impl<'g> PackageMetadata<'g>[src]

pub fn to_summary_id(&self) -> SummaryId[src]

Converts this metadata to a SummaryId.

Requires the summaries feature to be enabled.

Trait Implementations

impl<'g> Clone for PackageMetadata<'g>[src]

impl<'g> Copy for PackageMetadata<'g>[src]

impl<'g> Debug for PackageMetadata<'g>[src]

impl<'g> Eq for PackageMetadata<'g>[src]

impl<'g> PartialEq<PackageMetadata<'g>> for PackageMetadata<'g>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Clone + Send + Sync
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> SafeBorrow<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,