@@ -102,12 +102,28 @@ impl<C: Configuration> IngredientImpl<C> {
102
102
}
103
103
104
104
let next_id = Id :: from_u32 ( self . counter . fetch_add ( 1 , Ordering :: Relaxed ) ) ;
105
+ let durability = stamps[ 0 ] . durability ;
105
106
let value = Value {
106
107
id : next_id,
107
108
fields,
108
109
stamps,
109
110
} ;
110
- self . struct_map . insert ( value)
111
+ let struct_ = self . struct_map . insert ( value) ;
112
+ let id = format ! (
113
+ "id_{}_{}" ,
114
+ self . ingredient_index. as_usize( ) ,
115
+ next_id. as_u32( ) ,
116
+ ) ;
117
+ println ! ( r#" {id}("{:?}")"# , self . database_key_index( struct_) ) ;
118
+ println ! (
119
+ " style {id} fill:#{}" ,
120
+ match durability {
121
+ Durability :: LOW => "666" ,
122
+ Durability :: MEDIUM => "333" ,
123
+ _ => "000" ,
124
+ }
125
+ ) ;
126
+ struct_
111
127
}
112
128
113
129
/// Change the value of the field `field_index` to a new value.
@@ -161,17 +177,31 @@ impl<C: Configuration> IngredientImpl<C> {
161
177
) -> & ' db C :: Fields {
162
178
local_state:: attach ( db, |state| {
163
179
let field_ingredient_index = self . ingredient_index . successor ( field_index) ;
180
+ let input_db_key_index = self . database_key_index ( id) ;
164
181
let id = id. as_id ( ) ;
165
182
let value = self . struct_map . get ( id) ;
166
183
let stamp = & value. stamps [ field_index] ;
167
- state. report_tracked_read (
168
- DependencyIndex {
169
- ingredient_index : field_ingredient_index,
170
- key_index : Some ( id) ,
171
- } ,
172
- stamp. durability ,
173
- stamp. changed_at ,
184
+ let dep_index = DependencyIndex {
185
+ ingredient_index : field_ingredient_index,
186
+ key_index : Some ( id) ,
187
+ } ;
188
+ let input_id = format ! (
189
+ " id_{}_{}" ,
190
+ input_db_key_index. ingredient_index. as_usize( ) ,
191
+ input_db_key_index. key_index. as_u32( )
192
+ ) ;
193
+ let id = format ! ( "id_{}_{}" , field_ingredient_index. as_usize( ) , id. as_u32( ) , ) ;
194
+ println ! ( r#" {id}("{:?}")"# , dep_index) ;
195
+ println ! (
196
+ " style {id} fill:#{}" ,
197
+ match stamp. durability {
198
+ Durability :: LOW => "666" ,
199
+ Durability :: MEDIUM => "333" ,
200
+ _ => "000" ,
201
+ }
174
202
) ;
203
+ println ! ( " {id}-->{input_id}" ) ;
204
+ state. report_tracked_read ( dep_index, stamp. durability , stamp. changed_at ) ;
175
205
& value. fields
176
206
} )
177
207
}
0 commit comments