@@ -51,33 +51,6 @@ pub(crate) struct PartialSolution<DP: DependencyProvider> {
51
51
has_ever_backtracked : bool ,
52
52
}
53
53
54
- impl < DP : DependencyProvider > PartialSolution < DP > {
55
- pub fn display < ' a > ( & ' a self , package_store : & ' a HashArena < DP :: P > ) -> impl Display + ' a {
56
- struct PSDisplay < ' a , DP : DependencyProvider > ( & ' a PartialSolution < DP > , & ' a HashArena < DP :: P > ) ;
57
-
58
- impl < DP : DependencyProvider > Display for PSDisplay < ' _ , DP > {
59
- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
60
- let mut assignments: Vec < _ > = self
61
- . 0
62
- . package_assignments
63
- . iter ( )
64
- . map ( |( p, pa) | format ! ( "{:?} = '{}': {}" , p, self . 1 [ * p] , pa) )
65
- . collect ( ) ;
66
- assignments. sort ( ) ;
67
- write ! (
68
- f,
69
- "next_global_index: {}\n current_decision_level: {:?}\n package_assignments:\n {}" ,
70
- self . 0 . next_global_index,
71
- self . 0 . current_decision_level,
72
- assignments. join( "\t \n " )
73
- )
74
- }
75
- }
76
-
77
- PSDisplay ( self , package_store)
78
- }
79
- }
80
-
81
54
/// Package assignments contain the potential decision and derivations
82
55
/// that have already been made for a given package,
83
56
/// as well as the intersection of terms by all of these.
@@ -167,6 +140,31 @@ impl<DP: DependencyProvider> PartialSolution<DP> {
167
140
}
168
141
}
169
142
143
+ pub ( crate ) fn display < ' a > ( & ' a self , package_store : & ' a HashArena < DP :: P > ) -> impl Display + ' a {
144
+ struct PSDisplay < ' a , DP : DependencyProvider > ( & ' a PartialSolution < DP > , & ' a HashArena < DP :: P > ) ;
145
+
146
+ impl < DP : DependencyProvider > Display for PSDisplay < ' _ , DP > {
147
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
148
+ let mut assignments: Vec < _ > = self
149
+ . 0
150
+ . package_assignments
151
+ . iter ( )
152
+ . map ( |( p, pa) | format ! ( "{:?} = '{}': {}" , p, self . 1 [ * p] , pa) )
153
+ . collect ( ) ;
154
+ assignments. sort ( ) ;
155
+ write ! (
156
+ f,
157
+ "next_global_index: {}\n current_decision_level: {:?}\n package_assignments:\n {}" ,
158
+ self . 0 . next_global_index,
159
+ self . 0 . current_decision_level,
160
+ assignments. join( "\t \n " )
161
+ )
162
+ }
163
+ }
164
+
165
+ PSDisplay ( self , package_store)
166
+ }
167
+
170
168
/// Add a decision.
171
169
pub ( crate ) fn add_decision ( & mut self , package : Id < DP :: P > , version : DP :: V ) {
172
170
// Check that add_decision is never used in the wrong context.
0 commit comments