Skip to main content

Identifier

Trait Identifier 

Source
pub trait Identifier {
    // Required methods
    fn distribution_id(&self) -> DistributionId;
    fn resource_id(&self) -> ResourceId;
}

Required Methods§

Source

fn distribution_id(&self) -> DistributionId

Return a unique resource identifier for the distribution, like a SHA-256 hash of the distribution’s contents.

A distribution is a specific archive of a package at a specific version. For a given package version, there may be multiple distributions, e.g., source distribution, along with multiple binary distributions (wheels) for different platforms. As a concrete example, black-23.10.0-py3-none-any.whl would represent a (binary) distribution of the black package at version 23.10.0.

The distribution ID is used to uniquely identify a distribution. Ideally, the distribution ID should be a hash of the distribution’s contents, though in practice, it’s only required that the ID is unique within a single invocation of the resolver (and so, e.g., a hash of the URL would also be sufficient).

Source

fn resource_id(&self) -> ResourceId

Return a unique resource identifier for the underlying resource backing the distribution.

This is often equivalent to the distribution ID, but may differ in some cases. For example, if the same Git repository is used for two different distributions, at two different subdirectories or two different commits, then those distributions would share a resource ID, but have different distribution IDs.

Implementations on Foreign Types§

Source§

impl Identifier for Path

Source§

impl Identifier for DisplaySafeUrl

Implementors§