Skip to main content

uni_plugin/host/
mod.rs

1//! Host-side helpers for procedure execution and principal threading.
2//!
3//! Two helpers consolidate the §1.2 duplication flagged in
4//! `CODE_SIMPLIFIER_FEEDBACK.md`:
5//!
6//! - [`context::build_procedure_context`] — replaces the duplicated
7//!   "construct host + attach writer + read principal + build context"
8//!   block between `uni-query/src/query/executor/procedure.rs` and
9//!   `uni-query/src/query/df_graph/procedure_call.rs`.
10//! - [`principal::maybe_scope_with_principal`] — wraps the conditional
11//!   `match principal { Some(p) => scoped_with_principal(...).await, None => fut.await }`
12//!   pattern duplicated across `uni::api::{session,transaction}` and
13//!   `uni-query::df_udfs`.
14//!
15//! The principal task-local ([`principal::CURRENT_PRINCIPAL`]) and its
16//! `scoped_with_principal` / `current_principal` helpers also live here.
17//! `uni-query` re-exports them for backwards compatibility.
18
19// Rust guideline compliant
20
21pub mod context;
22pub mod principal;
23
24#[doc(inline)]
25pub use context::build_procedure_context;
26#[doc(inline)]
27pub use principal::{
28    CURRENT_PRINCIPAL, current_principal, maybe_scope_with_principal, scoped_with_principal,
29};