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§
sourcefn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(IndexSummary),
) -> Poll<CargoResult<()>>
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.
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.
sourcefn block_until_ready(&mut self) -> CargoResult<()>
fn block_until_ready(&mut self) -> CargoResult<()>
Block until all outstanding Poll::Pending
requests are Poll::Ready
.
Provided Methods§
sourcefn query_vec(
&mut self,
dep: &Dependency,
kind: QueryKind,
) -> Poll<CargoResult<Vec<IndexSummary>>>
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.