From adff751a7e2be04b4755a7d373dff1ce2647436d Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 21 Jan 2022 12:51:05 +0000 Subject: [PATCH] Ensure context canceller takes a reference --- src/ctx/canceller.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ctx/canceller.rs b/src/ctx/canceller.rs index 2705b3ec..25591bd1 100644 --- a/src/ctx/canceller.rs +++ b/src/ctx/canceller.rs @@ -1,6 +1,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +#[derive(Default)] pub struct Canceller { /// A reference to the canceled value of a context. cancelled: Arc, @@ -14,7 +15,7 @@ impl Canceller { } } // Cancel the context. - pub fn cancel(self) { + pub fn cancel(&self) { self.cancelled.store(true, Ordering::SeqCst); } }