@@ -92,7 +92,7 @@ impl<J: 'static + AsyncJob> AsyncSingleJob<J> {
92
92
}
93
93
94
94
/// makes sure `next` is cleared and returns `true` if it actually canceled something
95
- pub fn cancel ( & mut self ) -> bool {
95
+ pub fn cancel ( & self ) -> bool {
96
96
if let Ok ( mut next) = self . next . lock ( ) {
97
97
if next. is_some ( ) {
98
98
* next = None ;
@@ -111,7 +111,7 @@ impl<J: 'static + AsyncJob> AsyncSingleJob<J> {
111
111
/// spawns `task` if nothing is running currently,
112
112
/// otherwise schedules as `next` overwriting if `next` was set before.
113
113
/// return `true` if the new task gets started right away.
114
- pub fn spawn ( & mut self , task : J ) -> bool {
114
+ pub fn spawn ( & self , task : J ) -> bool {
115
115
self . schedule_next ( task) ;
116
116
self . check_for_job ( )
117
117
}
@@ -162,7 +162,7 @@ impl<J: 'static + AsyncJob> AsyncSingleJob<J> {
162
162
Ok ( ( ) )
163
163
}
164
164
165
- fn schedule_next ( & mut self , task : J ) {
165
+ fn schedule_next ( & self , task : J ) {
166
166
if let Ok ( mut next) = self . next . lock ( ) {
167
167
* next = Some ( task) ;
168
168
}
@@ -226,7 +226,7 @@ mod test {
226
226
fn test_overwrite ( ) {
227
227
let ( sender, receiver) = unbounded ( ) ;
228
228
229
- let mut job: AsyncSingleJob < TestJob > =
229
+ let job: AsyncSingleJob < TestJob > =
230
230
AsyncSingleJob :: new ( sender) ;
231
231
232
232
let task = TestJob {
@@ -265,7 +265,7 @@ mod test {
265
265
fn test_cancel ( ) {
266
266
let ( sender, receiver) = unbounded ( ) ;
267
267
268
- let mut job: AsyncSingleJob < TestJob > =
268
+ let job: AsyncSingleJob < TestJob > =
269
269
AsyncSingleJob :: new ( sender) ;
270
270
271
271
let task = TestJob {
0 commit comments