Skip to content

Commit

Permalink
fix todos. removing the Version trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Feb 5, 2025
1 parent 12fdf46 commit f543c55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
36 changes: 18 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@
//! we should try to provide a very human-readable and clear
//! explanation as to why that failed.
//!
//! # Package and Version traits
//!
//! All the code in this crate is manipulating packages and versions, and for this to work
//! we defined a [Package] trait
//! that is used as bounds on most of the exposed types and functions.
//!
//! Package identifiers needs to implement our [Package] trait,
//! which is automatic if the type already implements
//! [Clone] + [Eq] + [Hash] + [Debug] + [Display](std::fmt::Display).
//! So things like [String] will work out of the box.
//!
//! TODO! This is all wrong. Need to talk about VS, not Version.
//!
//! Our Version trait requires
//! [Clone] + [Ord] + [Debug] + [Display](std::fmt::Display).
//! For convenience, this library provides [SemanticVersion]
//! that implements semantic versioning rules.
//!
//! # Basic example
//!
//! Let's imagine that we are building a user interface
Expand Down Expand Up @@ -60,6 +42,24 @@
//! let solution = resolve(&dependency_provider, "root", 1u32).unwrap();
//! ```
//!
//! # Package and Version flexibility
//!
//! The [OfflineDependencyProvider] used in that example is generic over the way package names,
//! version requirements, and version numbers are represented.
//!
//! The first bound is the type of package names. It can be anything that implements our [Package] trait.
//! The [Package] trait is automatic if the type already implements
//! [Clone] + [Eq] + [Hash] + [Debug] + [Display](std::fmt::Display).
//! So things like [String] will work out of the box.
//!
//! The second bound is the type of package requirements. It can be anything that implements our [VersionSet] trait.
//! This trait is used to figure out how version requirements are combined.
//! If the normal [Ord]/[PartialEq] operations are all that is needed for requirements, our [Ranges] type will work.
//!
//! The chosen `VersionSet` in turn specifies what can be used for version numbers.
//! This type needs to at least implement [Clone] + [Ord] + [Debug] + [Display](std::fmt::Display).
//! For convenience, this library provides [SemanticVersion] that implements the basics of semantic versioning rules.
//!
//! # DependencyProvider trait
//!
//! In our previous example we used the
Expand Down
16 changes: 5 additions & 11 deletions src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ impl PackageResolutionStatistics {
}
}

/// Main function of the library.
///
/// Finds a set of packages satisfying dependency bounds for a given package + version pair.
///
/// It consists in efficiently finding a set of packages and versions
Expand All @@ -76,12 +74,11 @@ impl PackageResolutionStatistics {
/// version solving failed.
/// ```
///
/// TODO: there is not Version traits
/// The algorithm is generic and works for any type of dependency system
/// as long as packages (P) and versions (V) implement
/// the [Package] and Version traits.
/// [Package] is strictly equivalent and automatically generated
/// for any type that implement [Clone] + [Eq] + [Hash] + [Debug] + [Display].
/// Is generic over an implementation of [DependencyProvider] which represents where the dependency constraints come from.
/// The associated types on the DependencyProvider allow flexibility for the representation of
/// package names, version requirements, version numbers, and other things.
/// See its documentation for more details.
/// For simple cases [OfflineDependencyProvider](crate::OfflineDependencyProvider) may be sufficient.
///
/// ## API
///
Expand All @@ -103,9 +100,6 @@ impl PackageResolutionStatistics {
/// # }
/// ```
///
/// Where `dependency_provider` supplies the list of available packages and versions,
/// as well as the dependencies of every available package
/// by implementing the [DependencyProvider] trait.
/// The call to [resolve] for a given package at a given version
/// will compute the set of packages and versions needed
/// to satisfy the dependencies of that package and version pair.
Expand Down

0 comments on commit f543c55

Please sign in to comment.