From 4545fbfe0b3cee51516e2952184c0dc8560d1c8e Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Thu, 12 Jan 2023 21:54:53 +0800 Subject: [PATCH] better inline docs --- cozo-core/src/lib.rs | 1 + cozo-core/src/runtime/db.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cozo-core/src/lib.rs b/cozo-core/src/lib.rs index b6951602..a794ec28 100644 --- a/cozo-core/src/lib.rs +++ b/cozo-core/src/lib.rs @@ -67,6 +67,7 @@ pub use crate::data::expr::Expr; use crate::data::json::JsonValue; pub use crate::data::symb::Symbol; pub use crate::runtime::callback::CallbackOp; +pub use crate::runtime::db::Poison; #[cfg(not(target_arch = "wasm32"))] pub(crate) mod data; diff --git a/cozo-core/src/runtime/db.rs b/cozo-core/src/runtime/db.rs index feca0154..6689088d 100644 --- a/cozo-core/src/runtime/db.rs +++ b/cozo-core/src/runtime/db.rs @@ -1423,12 +1423,14 @@ impl<'s, S: Storage<'s>> Db { } } +/// Used for user-initiated termination of running queries #[derive(Clone, Default)] pub struct Poison(pub(crate) Arc); impl Poison { + /// Will return `Err` if user has initiated termination. #[inline(always)] - pub(crate) fn check(&self) -> Result<()> { + pub fn check(&self) -> Result<()> { #[derive(Debug, Error, Diagnostic)] #[error("Running query is killed before completion")] #[diagnostic(code(eval::killed))]