pub fn on_cancel(hook: impl Fn() + Send + Sync + 'static)Expand description
Run hook when core cancels a request, on the stdin reader’s thread, while the request is
still running on the main one (e.g. ask the server to cancel the query). Replaces any hook
set before. The request then fails, and the SDK replies with kind cancelled.
§Panics
Panics if the hook’s lock is poisoned (a hook set or run before panicked).