@@ -170,29 +170,29 @@ impl DeviceManager {
170
170
///
171
171
/// Panics if the underlying C function returns a null pointer.
172
172
pub fn set_device_description < F > ( & mut self , device : & str , description : & str , callback : F )
173
- -> Operation < dyn FnMut ( bool ) >
174
- where F : FnMut ( bool ) + ' static
173
+ -> Operation < dyn FnOnce ( bool ) >
174
+ where F : FnOnce ( bool ) + ' static
175
175
{
176
176
// Warning: New CStrings will be immediately freed if not bound to a
177
177
// variable, leading to as_ptr() giving dangling pointers!
178
178
let c_dev = CString :: new ( device. clone ( ) ) . unwrap ( ) ;
179
179
let c_desc = CString :: new ( description. clone ( ) ) . unwrap ( ) ;
180
180
181
- let cb_data = box_closure_get_capi_ptr :: < dyn FnMut ( bool ) > ( Box :: new ( callback) ) ;
181
+ let cb_data = box_closure_get_capi_ptr :: < dyn FnOnce ( bool ) > ( Box :: new ( callback) ) ;
182
182
let ptr = unsafe {
183
183
capi:: pa_ext_device_manager_set_device_description ( self . context , c_dev. as_ptr ( ) ,
184
184
c_desc. as_ptr ( ) , Some ( super :: success_cb_proxy) , cb_data)
185
185
} ;
186
- Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnMut ( bool ) > )
186
+ Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnOnce ( bool ) > )
187
187
}
188
188
189
189
/// Deletes entries from the device database.
190
190
///
191
191
/// The callback must accept a `bool`, which indicates success.
192
192
///
193
193
/// Panics if the underlying C function returns a null pointer.
194
- pub fn delete < F > ( & mut self , devices : & [ & str ] , callback : F ) -> Operation < dyn FnMut ( bool ) >
195
- where F : FnMut ( bool ) + ' static
194
+ pub fn delete < F > ( & mut self , devices : & [ & str ] , callback : F ) -> Operation < dyn FnOnce ( bool ) >
195
+ where F : FnOnce ( bool ) + ' static
196
196
{
197
197
// Warning: New CStrings will be immediately freed if not bound to a variable, leading to
198
198
// as_ptr() giving dangling pointers!
@@ -209,10 +209,10 @@ impl DeviceManager {
209
209
}
210
210
c_dev_ptrs. push ( null ( ) ) ;
211
211
212
- let cb_data = box_closure_get_capi_ptr :: < dyn FnMut ( bool ) > ( Box :: new ( callback) ) ;
212
+ let cb_data = box_closure_get_capi_ptr :: < dyn FnOnce ( bool ) > ( Box :: new ( callback) ) ;
213
213
let ptr = unsafe { capi:: pa_ext_device_manager_delete ( self . context , c_dev_ptrs. as_ptr ( ) ,
214
214
Some ( super :: success_cb_proxy) , cb_data) } ;
215
- Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnMut ( bool ) > )
215
+ Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnOnce ( bool ) > )
216
216
}
217
217
218
218
/// Enables the role-based device-priority routing mode.
@@ -221,15 +221,15 @@ impl DeviceManager {
221
221
///
222
222
/// Panics if the underlying C function returns a null pointer.
223
223
pub fn enable_role_device_priority_routing < F > ( & mut self , enable : bool , callback : F )
224
- -> Operation < dyn FnMut ( bool ) >
224
+ -> Operation < dyn FnOnce ( bool ) >
225
225
where F : FnMut ( bool ) + ' static
226
226
{
227
- let cb_data = box_closure_get_capi_ptr :: < dyn FnMut ( bool ) > ( Box :: new ( callback) ) ;
227
+ let cb_data = box_closure_get_capi_ptr :: < dyn FnOnce ( bool ) > ( Box :: new ( callback) ) ;
228
228
let ptr = unsafe {
229
229
capi:: pa_ext_device_manager_enable_role_device_priority_routing ( self . context ,
230
230
enable as i32 , Some ( super :: success_cb_proxy) , cb_data)
231
231
} ;
232
- Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnMut ( bool ) > )
232
+ Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnOnce ( bool ) > )
233
233
}
234
234
235
235
/// Reorders the position of a given device in the priority list to give preference to it.
@@ -238,8 +238,8 @@ impl DeviceManager {
238
238
///
239
239
/// Panics if the underlying C function returns a null pointer.
240
240
pub fn reorder_devices_for_role < F > ( & mut self , role : & str , devices : & [ & str ] , callback : F )
241
- -> Operation < dyn FnMut ( bool ) >
242
- where F : FnMut ( bool ) + ' static
241
+ -> Operation < dyn FnOnce ( bool ) >
242
+ where F : FnOnce ( bool ) + ' static
243
243
{
244
244
// Warning: New CStrings will be immediately freed if not bound to a variable, leading to
245
245
// as_ptr() giving dangling pointers!
@@ -257,26 +257,26 @@ impl DeviceManager {
257
257
}
258
258
c_dev_ptrs. push ( null ( ) ) ;
259
259
260
- let cb_data = box_closure_get_capi_ptr :: < dyn FnMut ( bool ) > ( Box :: new ( callback) ) ;
260
+ let cb_data = box_closure_get_capi_ptr :: < dyn FnOnce ( bool ) > ( Box :: new ( callback) ) ;
261
261
let ptr = unsafe {
262
262
capi:: pa_ext_device_manager_reorder_devices_for_role ( self . context , c_role. as_ptr ( ) ,
263
263
c_dev_ptrs. as_ptr ( ) , Some ( super :: success_cb_proxy) , cb_data)
264
264
} ;
265
- Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnMut ( bool ) > )
265
+ Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnOnce ( bool ) > )
266
266
}
267
267
268
268
/// Subscribes to changes in the device database.
269
269
///
270
270
/// The callback must accept a `bool`, which indicates success.
271
271
///
272
272
/// Panics if the underlying C function returns a null pointer.
273
- pub fn subscribe < F > ( & mut self , enable : bool , callback : F ) -> Operation < dyn FnMut ( bool ) >
274
- where F : FnMut ( bool ) + ' static
273
+ pub fn subscribe < F > ( & mut self , enable : bool , callback : F ) -> Operation < dyn FnOnce ( bool ) >
274
+ where F : FnOnce ( bool ) + ' static
275
275
{
276
- let cb_data = box_closure_get_capi_ptr :: < dyn FnMut ( bool ) > ( Box :: new ( callback) ) ;
276
+ let cb_data = box_closure_get_capi_ptr :: < dyn FnOnce ( bool ) > ( Box :: new ( callback) ) ;
277
277
let ptr = unsafe { capi:: pa_ext_device_manager_subscribe ( self . context , enable as i32 ,
278
278
Some ( super :: success_cb_proxy) , cb_data) } ;
279
- Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnMut ( bool ) > )
279
+ Operation :: from_raw ( ptr, cb_data as * mut Box < dyn FnOnce ( bool ) > )
280
280
}
281
281
282
282
/// Sets the subscription callback that is called when [`subscribe()`](Self::subscribe) was
0 commit comments