pub struct OfflineDependencyProvider<P: Package, VS: VersionSet> { /* private fields */ }
Expand description

A basic implementation of DependencyProvider.

Implementations§

source§

impl<P: Package, VS: VersionSet> OfflineDependencyProvider<P, VS>

source

pub fn new() -> Self

Creates an empty OfflineDependencyProvider with no dependencies.

source

pub fn add_dependencies<I: IntoIterator<Item = (P, VS)>>( &mut self, package: P, version: impl Into<VS::V>, dependencies: I )

Registers the dependencies of a package and version pair. Dependencies must be added with a single call to add_dependencies. All subsequent calls to add_dependencies for a given package version pair will replace the dependencies by the new ones.

The API does not allow to add dependencies one at a time to uphold an assumption that OfflineDependencyProvider.get_dependencies(p, v) provides all dependencies of a given package (p) and version (v) pair.

source

pub fn packages(&self) -> impl Iterator<Item = &P>

Lists packages that have been saved.

source

pub fn versions(&self, package: &P) -> Option<impl Iterator<Item = &VS::V>>

Lists versions of saved packages in sorted order. Returns None if no information is available regarding that package.

Trait Implementations§

source§

impl<P: Clone + Package, VS: Clone + VersionSet> Clone for OfflineDependencyProvider<P, VS>
where VS::V: Clone,

source§

fn clone(&self) -> OfflineDependencyProvider<P, VS>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<P: Debug + Package, VS: Debug + VersionSet> Debug for OfflineDependencyProvider<P, VS>
where VS::V: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<P: Default + Package, VS: Default + VersionSet> Default for OfflineDependencyProvider<P, VS>
where VS::V: Default,

source§

fn default() -> OfflineDependencyProvider<P, VS>

Returns the “default value” for a type. Read more
source§

impl<P: Package, VS: VersionSet> DependencyProvider for OfflineDependencyProvider<P, VS>

An implementation of DependencyProvider that contains all dependency information available in memory. Currently packages are picked with the fewest versions contained in the constraints first. But, that may change in new versions if better heuristics are found. Versions are picked with the newest versions first.

§

type P = P

How this provider stores the name of the packages.
§

type V = <VS as VersionSet>::V

How this provider stores the versions of the packages.
§

type VS = VS

How this provider stores the version requirements for the packages. The requirements must be able to process the same kind of version as this dependency provider.
§

type Err = Infallible

The kind of error returned from these methods. Read more
source§

fn choose_version( &self, package: &P, range: &VS ) -> Result<Option<VS::V>, Infallible>

Once the resolver has found the highest Priority package from all potential valid packages, it needs to know what vertion of that package to use. The most common pattern is to select the largest vertion that the range contains.
§

type Priority = Reverse<usize>

The type returned from prioritize. The resolver does not care what type this is as long as it can pick a largest one and clone it. Read more
source§

fn prioritize(&self, package: &P, range: &VS) -> Self::Priority

Decision making is the process of choosing the next package and version that will be appended to the partial solution. Read more
source§

fn get_dependencies( &self, package: &P, version: &VS::V ) -> Result<Dependencies<P, VS>, Infallible>

Retrieves the package dependencies. Return Dependencies::Unknown if its dependencies are unknown.
source§

fn should_cancel(&self) -> Result<(), Self::Err>

This is called fairly regularly during the resolution, if it returns an Err then resolution will be terminated. This is helpful if you want to add some form of early termination like a timeout, or you want to add some form of user feedback if things are taking a while. If not provided the resolver will run as long as needed.

Auto Trait Implementations§

§

impl<P, VS> Freeze for OfflineDependencyProvider<P, VS>

§

impl<P, VS> RefUnwindSafe for OfflineDependencyProvider<P, VS>

§

impl<P, VS> Send for OfflineDependencyProvider<P, VS>
where P: Send, VS: Send, <VS as VersionSet>::V: Send,

§

impl<P, VS> Sync for OfflineDependencyProvider<P, VS>
where P: Sync, VS: Sync, <VS as VersionSet>::V: Sync,

§

impl<P, VS> Unpin for OfflineDependencyProvider<P, VS>
where P: Unpin,

§

impl<P, VS> UnwindSafe for OfflineDependencyProvider<P, VS>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.