Trait cargo::core::registry::Registry

source ·
pub trait Registry {
    // Required methods
    fn query(
        &mut self,
        dep: &Dependency,
        kind: QueryKind,
        f: &mut dyn FnMut(IndexSummary),
    ) -> Poll<CargoResult<()>>;
    fn describe_source(&self, source: SourceId) -> String;
    fn is_replaced(&self, source: SourceId) -> bool;
    fn block_until_ready(&mut self) -> CargoResult<()>;

    // Provided method
    fn query_vec(
        &mut self,
        dep: &Dependency,
        kind: QueryKind,
    ) -> Poll<CargoResult<Vec<IndexSummary>>> { ... }
}
Expand description

An abstraction provides a set of methods for querying source information about a group of packages, without leaking too much implementation details of the actual registry.

As of 2024-04, only PackageRegistry and MyRegistry in resolver-tests are found implementing this.

See also the Source trait, as many of the methods here mirror and abstract over its functionalities.

Required Methods§

source

fn query( &mut self, dep: &Dependency, kind: QueryKind, f: &mut dyn FnMut(IndexSummary), ) -> Poll<CargoResult<()>>

Attempt to find the packages that match a dependency request.

source

fn describe_source(&self, source: SourceId) -> String

Gets the description of a source, to provide useful messages.

source

fn is_replaced(&self, source: SourceId) -> bool

Checks if a source is replaced with some other source.

source

fn block_until_ready(&mut self) -> CargoResult<()>

Block until all outstanding Poll::Pending requests are Poll::Ready.

Provided Methods§

source

fn query_vec( &mut self, dep: &Dependency, kind: QueryKind, ) -> Poll<CargoResult<Vec<IndexSummary>>>

Gathers the result from Registry::query as a list of IndexSummary items when they become available.

Implementors§

source§

impl<'gctx> Registry for PackageRegistry<'gctx>