pub struct Resolver { /* private fields */ }Expand description
Iterative dependency resolver that works in levels.
Instead of using a callback for index lookups (which would require blocking HTTP inside an async runtime), this resolver works in a pull-based way:
- Call
seed()with your direct dependencies - Call
pending_crates()to get crate names that need index data - Fetch those indexes (async, in the caller)
- Call
provide_index()for each fetched index - Call
advance()to process one level of the graph - Repeat 2-5 until
pending_crates()returns empty - Call
finish()to get the resolved graph
Implementations§
Source§impl Resolver
impl Resolver
pub fn new() -> Self
Sourcepub fn seed(&mut self, deps: &BTreeMap<String, String>)
pub fn seed(&mut self, deps: &BTreeMap<String, String>)
Seed the resolver with direct dependencies from depends.toml.
Sourcepub fn provide_index(&mut self, name: &str, entries: Vec<IndexEntry>)
pub fn provide_index(&mut self, name: &str, entries: Vec<IndexEntry>)
Provide index entries for a crate (fetched by the caller).
Sourcepub fn pending_crates(&self) -> Vec<String>
pub fn pending_crates(&self) -> Vec<String>
Return the names of crates that are queued but whose index data
is not yet in the cache. The caller should fetch these and call
provide_index before calling advance.
Auto Trait Implementations§
impl Freeze for Resolver
impl RefUnwindSafe for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl UnsafeUnpin for Resolver
impl UnwindSafe for Resolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more