File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -221,22 +221,29 @@ where
221
221
}
222
222
}
223
223
224
- /// A single notification.
225
- pub ( crate ) struct SingleNotify < T > {
224
+ /// A generic notification.
225
+ pub ( crate ) struct GenericNotify < F > {
226
+ /// Number of listeners to notify.
227
+ count : usize ,
228
+
229
+ /// Whether this notification is additional.
226
230
additional : bool ,
227
- tag : Option < T > ,
231
+
232
+ /// Generate tags.
233
+ tags : F ,
228
234
}
229
235
230
- impl < T > SingleNotify < T > {
231
- pub ( crate ) fn new ( additional : bool , tag : T ) -> Self {
236
+ impl < T , F : FnMut ( ) -> T > GenericNotify < F > {
237
+ pub ( crate ) fn new ( count : usize , additional : bool , tags : F ) -> Self {
232
238
Self {
239
+ count,
233
240
additional,
234
- tag : Some ( tag ) ,
241
+ tags ,
235
242
}
236
243
}
237
244
}
238
245
239
- impl < T > Notification for SingleNotify < T > {
246
+ impl < T , F : FnMut ( ) -> T > Notification for GenericNotify < F > {
240
247
type Tag = T ;
241
248
242
249
fn is_additional ( & self ) -> bool {
@@ -248,11 +255,11 @@ impl<T> Notification for SingleNotify<T> {
248
255
}
249
256
250
257
fn count ( & self ) -> usize {
251
- 1
258
+ self . count
252
259
}
253
260
254
261
fn next_tag ( & mut self ) -> Self :: Tag {
255
- self . tag . take ( ) . unwrap ( )
262
+ ( self . tags ) ( )
256
263
}
257
264
}
258
265
You can’t perform that action at this time.
0 commit comments