/// The last result that we captured, for diffing
prev_list: List,
/// User's callback
- cb: Box<dyn FnMut(Update) + 'static>,
+ cb: Box<dyn FnMut(Update) + Send + 'static>,
}
pub(crate) struct WatchHandle {
}
}
-pub(crate) fn watch_interfaces<F: FnMut(Update) + 'static>(
+pub(crate) fn watch_interfaces<F: FnMut(Update) + Send + 'static>(
callback: F,
) -> Result<WatchHandle, Error> {
let state = Box::pin(Mutex::new(WatchState {
) {
let state_ptr = ctx as *const Mutex<WatchState>;
unsafe {
- let state_guard = &mut *state_ptr.as_ref().unwrap().lock().unwrap();
+ let state_guard = &mut *state_ptr.as_ref()
+ .expect("callback ctx should never be null")
+ .lock()
+ .unwrap();
handle_notif(state_guard);
}
}