Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Apr 17, 2024
1 parent 10cf15c commit 8ee971d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/caching_dependency_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<DP: DependencyProvider<M = String>> DependencyProvider for CachingDependenc
) -> Result<Dependencies<DP::P, DP::VS, DP::M>, DP::Err> {
let mut cache = self.cached_dependencies.borrow_mut();
match cache.get_dependencies(package, version) {
Ok(Dependencies::Unknown(reason)) => {
Ok(Dependencies::Unknown(_)) => {
let dependencies = self.remote_dependencies.get_dependencies(package, version);
match dependencies {
Ok(Dependencies::Known(dependencies)) => {
Expand Down
10 changes: 8 additions & 2 deletions src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,14 @@ pub trait DependencyProvider {
type P: Package;

/// How this provider stores the versions of the packages.
///
/// A common choice is [`SemanticVersion`][crate::version::SemanticVersion].
type V: Debug + Display + Clone + Ord;

/// 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.
///
/// A common choice is [`Range`][crate::range::Range].
type VS: VersionSet<V = Self::V>;

/// Type for custom incompatibilities.
Expand All @@ -218,8 +222,10 @@ pub trait DependencyProvider {
/// to be unavailable. Examples:
/// * The version would require building the package, but builds are disabled.
/// * The package is not available in the cache, but internet access has been disabled.
/// The intended use is to track them in an enum and assign them to this type. This also
/// supports collapsing custom incompatibilities in error messages.
/// * The package uses a legacy format not supported anymore.
///
/// The intended use is to track them in an enum and assign them to this type. You can also
/// assign [`String`] as placeholder.
type M: Eq + Clone + Debug + Display;

/// [Decision making](https://github.com/dart-lang/pub/blob/master/doc/solver.md#decision-making)
Expand Down

0 comments on commit 8ee971d

Please sign in to comment.