diff --git a/src/buffer/controller.rs b/src/buffer/controller.rs index 9fd883f..057bda6 100644 --- a/src/buffer/controller.rs +++ b/src/buffer/controller.rs @@ -12,7 +12,7 @@ use crate::api::Controller; use crate::api::TextChange; -use super::tools::InternallyMutable; +use crate::ext::InternallyMutable; /// the buffer controller implementation /// diff --git a/src/buffer/mod.rs b/src/buffer/mod.rs index dfaff9f..1610400 100644 --- a/src/buffer/mod.rs +++ b/src/buffer/mod.rs @@ -9,9 +9,6 @@ /// buffer controller implementation pub mod controller; -/// assorted helpers to handle buffer controllers -pub mod tools; - pub(crate) mod worker; pub use controller::BufferController as Controller; diff --git a/src/buffer/tools.rs b/src/ext.rs similarity index 90% rename from src/buffer/tools.rs rename to src/ext.rs index 0e40359..2bfc362 100644 --- a/src/buffer/tools.rs +++ b/src/ext.rs @@ -81,3 +81,11 @@ impl InternallyMutable { self.getter.borrow().clone() } } + +pub(crate) struct CallbackHandleWatch(pub(crate) tokio::sync::watch::Sender>); + +impl crate::api::controller::CallbackHandle for CallbackHandleWatch { + fn unregister(self) { + self.0.send_replace(None); + } +} diff --git a/src/lib.rs b/src/lib.rs index c2f502f..99390df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,6 +140,9 @@ pub mod prelude; /// language-specific ffi "glue" pub mod ffi; +/// common utils used in this library and re-exposed +pub mod ext; + /// underlying OperationalTransform library used, re-exported pub use woot;