diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-10 00:32:08 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-10 00:32:08 +0900 |
| commit | 8cc1ba8a02c0318b65658f1634de378c780392b9 (patch) | |
| tree | fdd5cb61e488018891a486b25991b87c84220bb8 /crates/mozart-sat-resolver/src/request.rs | |
| parent | 72b2e877c01e67ba7edd37e34ac2eadb7a1c62c4 (diff) | |
| download | php-mozart-8cc1ba8a02c0318b65658f1634de378c780392b9.tar.gz php-mozart-8cc1ba8a02c0318b65658f1634de378c780392b9.tar.zst php-mozart-8cc1ba8a02c0318b65658f1634de378c780392b9.zip | |
refactor(workspace): consolidate crates into mozart-core
Merged mozart-archiver, mozart-autoload, mozart-registry,
mozart-sat-resolver, and mozart-vcs into mozart-core to align
the source layout with Composer's structure.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-sat-resolver/src/request.rs')
| -rw-r--r-- | crates/mozart-sat-resolver/src/request.rs | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/crates/mozart-sat-resolver/src/request.rs b/crates/mozart-sat-resolver/src/request.rs deleted file mode 100644 index 26c17ba..0000000 --- a/crates/mozart-sat-resolver/src/request.rs +++ /dev/null @@ -1,65 +0,0 @@ -use crate::pool::PackageId; -use indexmap::IndexMap; - -/// A requirement: package name + version constraint string. -#[derive(Debug, Clone)] -pub struct Require { - pub package_name: String, - pub constraint: Option<String>, -} - -/// A request for the solver: what to install/fix/lock. -/// -/// Port of Composer's Request.php. -#[derive(Debug, Clone)] -pub struct Request { - /// Root requirements: package name → constraint string. - pub requires: IndexMap<String, Option<String>>, - /// Fixed packages (must be installed, cannot be modified). - pub fixed_packages: Vec<PackageId>, - /// Locked packages (installed but can be removed if nothing requires them). - pub locked_packages: Vec<PackageId>, -} - -impl Request { - pub fn new() -> Self { - Request { - requires: IndexMap::new(), - fixed_packages: Vec::new(), - locked_packages: Vec::new(), - } - } - - /// Add a root requirement. - pub fn require_name(&mut self, package_name: &str, constraint: Option<&str>) { - self.requires.insert( - package_name.to_lowercase(), - constraint.map(|s| s.to_string()), - ); - } - - /// Mark a package as fixed (must remain installed). - pub fn fix_package(&mut self, package_id: PackageId) { - if !self.fixed_packages.contains(&package_id) { - self.fixed_packages.push(package_id); - } - } - - /// Mark a package as locked. - pub fn lock_package(&mut self, package_id: PackageId) { - if !self.locked_packages.contains(&package_id) { - self.locked_packages.push(package_id); - } - } - - /// Check if a package is fixed. - pub fn is_fixed(&self, package_id: PackageId) -> bool { - self.fixed_packages.contains(&package_id) - } -} - -impl Default for Request { - fn default() -> Self { - Self::new() - } -} |
