File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ pub trait IdProvider {
49
49
50
50
/// Provides a thread-safe incrementing integer which
51
51
/// can be used as a subscription ID.
52
- #[ derive( Debug ) ]
52
+ #[ derive( Clone , Debug ) ]
53
53
pub struct NumericIdProvider {
54
- current_id : AtomicUsize ,
54
+ current_id : Arc < AtomicUsize > ,
55
55
}
56
56
57
57
impl NumericIdProvider {
@@ -63,7 +63,9 @@ impl NumericIdProvider {
63
63
/// Create a new NumericIdProvider starting from
64
64
/// the given ID.
65
65
pub fn with_id ( id : AtomicUsize ) -> Self {
66
- Self { current_id : id }
66
+ Self {
67
+ current_id : Arc :: new ( id) ,
68
+ }
67
69
}
68
70
}
69
71
@@ -78,7 +80,7 @@ impl IdProvider for NumericIdProvider {
78
80
impl Default for NumericIdProvider {
79
81
fn default ( ) -> Self {
80
82
NumericIdProvider {
81
- current_id : AtomicUsize :: new ( 1 ) ,
83
+ current_id : Arc :: new ( AtomicUsize :: new ( 1 ) ) ,
82
84
}
83
85
}
84
86
}
You can’t perform that action at this time.
0 commit comments