@@ -37,14 +37,14 @@ impl<LABEL> Default for ExplicitClose<LABEL> {
37
37
impl < LABEL > Sealed for ExplicitClose < LABEL > { }
38
38
39
39
impl < LABEL : Hash + Eq + Label , DATA > Completeness < LABEL , DATA > for ExplicitClose < LABEL > {
40
- fn cmpl_new_scope ( & self , _: & mut InnerScopeGraph < LABEL , DATA > , _: Scope ) {
40
+ fn cmpl_new_scope ( & self , _: & InnerScopeGraph < LABEL , DATA > , _: Scope ) {
41
41
<ExplicitClose < LABEL > as CriticalEdgeBasedCompleteness < LABEL , DATA > >:: init_scope_with (
42
42
self ,
43
43
LABEL :: iter ( ) . collect ( ) , // init with all labels: programmer is responsible for closing edges
44
44
)
45
45
}
46
46
47
- fn cmpl_new_complete_scope ( & self , _: & mut InnerScopeGraph < LABEL , DATA > , _: Scope ) {
47
+ fn cmpl_new_complete_scope ( & self , _: & InnerScopeGraph < LABEL , DATA > , _: Scope ) {
48
48
<ExplicitClose < LABEL > as CriticalEdgeBasedCompleteness < LABEL , DATA > >:: init_scope_with (
49
49
self ,
50
50
HashSet :: new ( ) , // init with empty label set to prevent extension
@@ -55,7 +55,7 @@ impl<LABEL: Hash + Eq + Label, DATA> Completeness<LABEL, DATA> for ExplicitClose
55
55
56
56
fn cmpl_new_edge (
57
57
& self ,
58
- inner_scope_graph : & mut InnerScopeGraph < LABEL , DATA > ,
58
+ inner_scope_graph : & InnerScopeGraph < LABEL , DATA > ,
59
59
src : Scope ,
60
60
lbl : LABEL ,
61
61
dst : Scope ,
@@ -110,17 +110,20 @@ impl<LABEL: Hash + Eq> ExplicitClose<LABEL> {
110
110
}
111
111
}
112
112
113
- impl < LABEL : Hash + Eq , DATA > ScopeGraph < LABEL , DATA , ExplicitClose < LABEL > > {
113
+ impl < ' sg , LABEL : Hash + Eq , DATA > ScopeGraph < ' sg , LABEL , DATA , ExplicitClose < LABEL > > {
114
114
/// Closes an edge, (i.e., prohibit future new
115
115
///
116
116
/// For example, the following program will return an error.
117
117
/// ```
118
118
/// # use scopegraphs_lib::completeness::ExplicitClose;
119
119
/// # use scopegraphs_lib::ScopeGraph;
120
120
/// # use scopegraphs_macros::Label;
121
+ /// # use scopegraphs::storage::Storage;
122
+ ///
121
123
/// # #[derive(Eq, Hash, PartialEq, Label)] enum Lbl { Def }
122
124
/// # use Lbl::*;
123
- /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(ExplicitClose::default());
125
+ /// let storage = Storage::new();
126
+ /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(&storage, ExplicitClose::default());
124
127
///
125
128
/// let s1 = sg.add_scope_with(0, [Def]);
126
129
/// let s2 = sg.add_scope_closed(42);
@@ -136,14 +139,16 @@ impl<LABEL: Hash + Eq, DATA> ScopeGraph<LABEL, DATA, ExplicitClose<LABEL>> {
136
139
/// # use scopegraphs_lib::ScopeGraph;
137
140
/// # use scopegraphs_lib::resolve::{DefaultDataEquiv, DefaultLabelOrder, EdgeOrData, Resolve};
138
141
/// # use scopegraphs_macros::{compile_regex, Label};
142
+ /// # use scopegraphs::storage::Storage;
139
143
/// #
140
144
/// # #[derive(Eq, Hash, PartialEq, Label, Debug, Copy, Clone)]
141
145
/// # enum Lbl { Def }
142
146
/// # use Lbl::*;
143
147
/// # type LblD = EdgeOrData<Lbl>;
144
148
/// #
145
149
/// # compile_regex!(type Regex<Lbl> = Def);
146
- /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(ExplicitClose::default());
150
+ /// let storage = Storage::new();
151
+ /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(&storage, ExplicitClose::default());
147
152
///
148
153
/// let s1 = sg.add_scope_with(0, [Def]);
149
154
/// let s2 = sg.add_scope_closed(42);
@@ -165,14 +170,16 @@ impl<LABEL: Hash + Eq, DATA> ScopeGraph<LABEL, DATA, ExplicitClose<LABEL>> {
165
170
/// # use scopegraphs_lib::ScopeGraph;
166
171
/// # use scopegraphs_lib::resolve::{DefaultDataEquiv, DefaultLabelOrder, EdgeOrData, Resolve};
167
172
/// # use scopegraphs_macros::{compile_regex, Label};
173
+ /// # use scopegraphs_lib::storage::Storage;
168
174
/// #
169
175
/// # #[derive(Eq, Hash, PartialEq, Label, Debug, Copy, Clone)]
170
176
/// # enum Lbl { Def }
171
177
/// # use Lbl::*;
172
178
/// # type LblD = EdgeOrData<Lbl>;
173
179
/// #
174
180
/// # compile_regex!(type Regex<Lbl> = Def);
175
- /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(ExplicitClose::default());
181
+ /// let storage = Storage::new();
182
+ /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(&storage, ExplicitClose::default());
176
183
///
177
184
/// let s1 = sg.add_scope_with(0, [Def]);
178
185
/// let s2 = sg.add_scope_closed(42);
@@ -192,18 +199,20 @@ impl<LABEL: Hash + Eq, DATA> ScopeGraph<LABEL, DATA, ExplicitClose<LABEL>> {
192
199
}
193
200
}
194
201
195
- impl < LABEL : Hash + Eq + Copy , DATA > ScopeGraph < LABEL , DATA , FutureCompleteness < LABEL > > {
202
+ impl < ' sg , LABEL : Hash + Eq + Copy , DATA > ScopeGraph < ' sg , LABEL , DATA , FutureCompleteness < LABEL > > {
196
203
/// TODO: update this example to use futures
197
204
/// Closes an edge, (i.e., prohibit future new
198
205
///
199
206
/// For example, the following program will return an error.
200
207
/// ```
201
208
/// # use scopegraphs_lib::completeness::ExplicitClose;
202
- /// # use scopegraphs_lib::ScopeGraph;
209
+ /// # use scopegraphs_lib::{ ScopeGraph, storage} ;
203
210
/// # use scopegraphs_macros::Label;
211
+ /// # use scopegraphs_lib::storage::Storage;
204
212
/// # #[derive(Eq, Hash, PartialEq, Label)] enum Lbl { Def }
205
213
/// # use Lbl::*;
206
- /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(ExplicitClose::default());
214
+ /// let storage = Storage::new();
215
+ /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(&storage, ExplicitClose::default());
207
216
///
208
217
/// let s1 = sg.add_scope_with(0, [Def]);
209
218
/// let s2 = sg.add_scope_closed(42);
@@ -219,14 +228,16 @@ impl<LABEL: Hash + Eq + Copy, DATA> ScopeGraph<LABEL, DATA, FutureCompleteness<L
219
228
/// # use scopegraphs_lib::ScopeGraph;
220
229
/// # use scopegraphs_lib::resolve::{DefaultDataEquiv, DefaultLabelOrder, EdgeOrData, Resolve};
221
230
/// # use scopegraphs_macros::{compile_regex, Label};
231
+ /// # use scopegraphs_lib::storage::Storage;
222
232
/// #
223
233
/// # #[derive(Eq, Hash, PartialEq, Label, Debug, Copy, Clone)]
224
234
/// # enum Lbl { Def }
225
235
/// # use Lbl::*;
226
236
/// # type LblD = EdgeOrData<Lbl>;
227
237
/// #
228
238
/// # compile_regex!(type Regex<Lbl> = Def);
229
- /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(ExplicitClose::default());
239
+ /// let storage = Storage::new();
240
+ /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(&storage, ExplicitClose::default());
230
241
///
231
242
/// let s1 = sg.add_scope_with(0, [Def]);
232
243
/// let s2 = sg.add_scope_closed(42);
@@ -248,14 +259,16 @@ impl<LABEL: Hash + Eq + Copy, DATA> ScopeGraph<LABEL, DATA, FutureCompleteness<L
248
259
/// # use scopegraphs_lib::ScopeGraph;
249
260
/// # use scopegraphs_lib::resolve::{DefaultDataEquiv, DefaultLabelOrder, EdgeOrData, Resolve};
250
261
/// # use scopegraphs_macros::{compile_regex, Label};
262
+ /// # use scopegraphs_lib::storage::Storage;
251
263
/// #
252
264
/// # #[derive(Eq, Hash, PartialEq, Label, Debug, Copy, Clone)]
253
265
/// # enum Lbl { Def }
254
266
/// # use Lbl::*;
255
267
/// # type LblD = EdgeOrData<Lbl>;
256
268
/// #
257
269
/// # compile_regex!(type Regex<Lbl> = Def);
258
- /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(ExplicitClose::default());
270
+ /// let storage = Storage::new();
271
+ /// let mut sg = ScopeGraph::<Lbl, usize, _>::new(&storage, ExplicitClose::default());
259
272
///
260
273
/// let s1 = sg.add_scope_with(0, [Def]);
261
274
/// let s2 = sg.add_scope_closed(42);
0 commit comments