pub trait Registry {
// Required methods
async fn query(
&self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(IndexSummary),
) -> CargoResult<()>;
fn describe_source(&self, source: SourceId) -> String;
fn is_replaced(&self, source: SourceId) -> bool;
// Provided method
async fn query_vec(
&self,
dep: &Dependency,
kind: QueryKind,
) -> 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§
Sourceasync fn query(
&self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(IndexSummary),
) -> CargoResult<()>
async fn query( &self, dep: &Dependency, kind: QueryKind, f: &mut dyn FnMut(IndexSummary), ) -> CargoResult<()>
Attempt to find the packages that match a dependency request.
Sourcefn describe_source(&self, source: SourceId) -> String
fn describe_source(&self, source: SourceId) -> String
Gets the description of a source, to provide useful messages.
Sourcefn is_replaced(&self, source: SourceId) -> bool
fn is_replaced(&self, source: SourceId) -> bool
Checks if a source is replaced with some other source.
Provided Methods§
Sourceasync fn query_vec(
&self,
dep: &Dependency,
kind: QueryKind,
) -> CargoResult<Vec<IndexSummary>>
async fn query_vec( &self, dep: &Dependency, kind: QueryKind, ) -> CargoResult<Vec<IndexSummary>>
Gathers the result from Registry::query as a list of IndexSummary items
when they become available.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".