@@ -23,18 +23,19 @@ use std::{
2323} ;
2424
2525#[ derive( Clone ) ]
26- pub struct LazyNodeState < ' graph , Op , G , GH = Const < bool > > {
27- nodes : Nodes < ' graph , G , GH > ,
26+ pub struct LazyNodeState < ' graph , Op , G , GH , F = Const < bool > > {
27+ nodes : Nodes < ' graph , G , GH , F > ,
2828 pub ( crate ) op : Op ,
2929}
3030
3131impl <
3232 ' graph ,
3333 O : NodeOp + ' graph ,
3434 G : GraphViewOps < ' graph > ,
35- GH : NodeFilterOp + Clone + ' graph ,
35+ GH : GraphViewOps < ' graph > ,
36+ F : NodeFilterOp + Clone + ' graph ,
3637 RHS ,
37- > PartialEq < & [ RHS ] > for LazyNodeState < ' graph , O , G , GH >
38+ > PartialEq < & [ RHS ] > for LazyNodeState < ' graph , O , G , GH , F >
3839where
3940 O :: Output : PartialEq < RHS > ,
4041{
@@ -47,10 +48,11 @@ impl<
4748 ' graph ,
4849 O : NodeOp + ' graph ,
4950 G : GraphViewOps < ' graph > ,
50- GH : NodeFilterOp + Clone + ' graph ,
51+ GH : GraphViewOps < ' graph > ,
52+ F : NodeFilterOp + Clone + ' graph ,
5153 RHS ,
5254 const N : usize ,
53- > PartialEq < [ RHS ; N ] > for LazyNodeState < ' graph , O , G , GH >
55+ > PartialEq < [ RHS ; N ] > for LazyNodeState < ' graph , O , G , GH , F >
5456where
5557 O :: Output : PartialEq < RHS > ,
5658{
6365 ' graph ,
6466 O : NodeOp + ' graph ,
6567 G : GraphViewOps < ' graph > ,
66- GH : NodeFilterOp + Clone + ' graph ,
68+ GH : GraphViewOps < ' graph > ,
69+ F : NodeFilterOp + Clone + ' graph ,
6770 RHS : NodeStateOps < ' graph , OwnedValue = O :: Output > ,
68- > PartialEq < RHS > for LazyNodeState < ' graph , O , G , GH >
71+ > PartialEq < RHS > for LazyNodeState < ' graph , O , G , GH , F >
6972where
7073 O :: Output : PartialEq ,
7174{
8487 ' graph ,
8588 O : NodeOp + ' graph ,
8689 G : GraphViewOps < ' graph > ,
87- GH : NodeFilterOp + Clone + ' graph ,
90+ GH : GraphViewOps < ' graph > ,
91+ F : NodeFilterOp + Clone + ' graph ,
8892 RHS ,
89- > PartialEq < Vec < RHS > > for LazyNodeState < ' graph , O , G , GH >
93+ > PartialEq < Vec < RHS > > for LazyNodeState < ' graph , O , G , GH , F >
9094where
9195 O :: Output : PartialEq < RHS > ,
9296{
9599 }
96100}
97101
98- impl < ' graph , G : GraphViewOps < ' graph > , GH : NodeFilterOp + ' graph , O : NodeOp + ' graph > Debug
99- for LazyNodeState < ' graph , O , G , GH >
102+ impl <
103+ ' graph ,
104+ G : GraphViewOps < ' graph > ,
105+ GH : GraphViewOps < ' graph > ,
106+ F : NodeFilterOp + ' graph ,
107+ O : NodeOp + ' graph ,
108+ > Debug for LazyNodeState < ' graph , O , G , GH , F >
100109where
101110 O :: Output : Debug ,
102111{
@@ -105,10 +114,15 @@ where
105114 }
106115}
107116
108- impl < ' graph , O : NodeOp + ' graph , G : GraphViewOps < ' graph > , GH : NodeFilterOp + Clone + ' graph >
109- IntoIterator for LazyNodeState < ' graph , O , G , GH >
117+ impl <
118+ ' graph ,
119+ O : NodeOp + ' graph ,
120+ G : GraphViewOps < ' graph > ,
121+ GH : GraphViewOps < ' graph > ,
122+ F : NodeFilterOp + Clone + ' graph ,
123+ > IntoIterator for LazyNodeState < ' graph , O , G , GH , F >
110124{
111- type Item = ( NodeView < ' graph , G > , O :: Output ) ;
125+ type Item = ( NodeView < ' graph , GH > , O :: Output ) ;
112126 type IntoIter = BoxedLIter < ' graph , Self :: Item > ;
113127
114128 fn into_iter ( self ) -> Self :: IntoIter {
@@ -120,21 +134,26 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clo
120134 }
121135}
122136
123- impl < O , G : IntoDynamic , GH : IntoDynNodeOp + NodeFilterOp + ' static >
124- LazyNodeState < ' static , O , G , GH >
137+ impl < O , G : IntoDynamic , GH : IntoDynamic , F : IntoDynNodeOp + NodeFilterOp + ' static >
138+ LazyNodeState < ' static , O , G , GH , F >
125139{
126- pub fn into_dyn ( self ) -> LazyNodeState < ' static , O , DynamicGraph , DynNodeFilter > {
140+ pub fn into_dyn ( self ) -> LazyNodeState < ' static , O , DynamicGraph , DynamicGraph , DynNodeFilter > {
127141 LazyNodeState {
128142 nodes : self . nodes . into_dyn ( ) ,
129143 op : self . op ,
130144 }
131145 }
132146}
133147
134- impl < ' graph , O : NodeOp + ' graph , G : GraphViewOps < ' graph > , GH : NodeFilterOp + Clone + ' graph >
135- LazyNodeState < ' graph , O , G , GH >
148+ impl <
149+ ' graph ,
150+ O : NodeOp + ' graph ,
151+ G : GraphViewOps < ' graph > ,
152+ GH : GraphViewOps < ' graph > ,
153+ F : NodeFilterOp + Clone + ' graph ,
154+ > LazyNodeState < ' graph , O , G , GH , F >
136155{
137- pub ( crate ) fn new ( op : O , nodes : Nodes < ' graph , G , GH > ) -> Self {
156+ pub ( crate ) fn new ( op : O , nodes : Nodes < ' graph , G , GH , F > ) -> Self {
138157 Self { nodes, op }
139158 }
140159
@@ -146,7 +165,7 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clo
146165 self . collect ( )
147166 }
148167
149- pub fn compute ( & self ) -> NodeState < ' graph , O :: Output , G > {
168+ pub fn compute ( & self ) -> NodeState < ' graph , O :: Output , GH > {
150169 if self . nodes . is_filtered ( ) {
151170 let ( keys, values) : ( IndexSet < _ , ahash:: RandomState > , Vec < _ > ) = self
152171 . par_iter ( )
@@ -164,19 +183,25 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clo
164183 }
165184}
166185
167- impl < ' graph , O : NodeOp + ' graph , G : GraphViewOps < ' graph > , GH : NodeFilterOp + ' graph >
168- NodeStateOps < ' graph > for LazyNodeState < ' graph , O , G , GH >
186+ impl <
187+ ' graph ,
188+ O : NodeOp + ' graph ,
189+ G : GraphViewOps < ' graph > ,
190+ GH : GraphViewOps < ' graph > ,
191+ F : NodeFilterOp + ' graph ,
192+ > NodeStateOps < ' graph > for LazyNodeState < ' graph , O , G , GH , F >
169193{
170- type Select = GH ;
194+ type Select = F ;
171195 type BaseGraph = G ;
196+ type Graph = GH ;
172197 type Value < ' a >
173198 = O :: Output
174199 where
175200 ' graph : ' a ,
176201 Self : ' a ;
177202 type OwnedValue = O :: Output ;
178203
179- fn graph ( & self ) -> & Self :: BaseGraph {
204+ fn graph ( & self ) -> & Self :: Graph {
180205 & self . nodes . graph
181206 }
182207
@@ -216,7 +241,7 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'gr
216241
217242 fn iter < ' a > (
218243 & ' a self ,
219- ) -> impl Iterator < Item = ( NodeView < ' a , & ' a Self :: BaseGraph > , Self :: Value < ' a > ) > + ' a
244+ ) -> impl Iterator < Item = ( NodeView < ' a , & ' a Self :: Graph > , Self :: Value < ' a > ) > + ' a
220245 where
221246 ' graph : ' a ,
222247 {
@@ -226,13 +251,13 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'gr
226251 . map ( move |node| ( node, self . op . apply ( & storage, node. node ) ) )
227252 }
228253
229- fn nodes ( & self ) -> Nodes < ' graph , Self :: BaseGraph , Self :: Select > {
254+ fn nodes ( & self ) -> Nodes < ' graph , Self :: BaseGraph , Self :: Graph , Self :: Select > {
230255 self . nodes . clone ( )
231256 }
232257
233258 fn par_iter < ' a > (
234259 & ' a self ,
235- ) -> impl ParallelIterator < Item = ( NodeView < ' a , & ' a Self :: BaseGraph > , Self :: Value < ' a > ) >
260+ ) -> impl ParallelIterator < Item = ( NodeView < ' a , & ' a Self :: Graph > , Self :: Value < ' a > ) >
236261 where
237262 ' graph : ' a ,
238263 {
@@ -242,7 +267,7 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'gr
242267 . map ( move |node| ( node, self . op . apply ( & storage, node. node ) ) )
243268 }
244269
245- fn get_by_index ( & self , index : usize ) -> Option < ( NodeView < & Self :: BaseGraph > , Self :: Value < ' _ > ) > {
270+ fn get_by_index ( & self , index : usize ) -> Option < ( NodeView < & Self :: Graph > , Self :: Value < ' _ > ) > {
246271 if self . nodes ( ) . is_list_filtered ( ) {
247272 self . iter ( ) . nth ( index)
248273 } else {
0 commit comments