diff --git a/vortex-array/src/aggregate_fn/proto.rs b/vortex-array/src/aggregate_fn/proto.rs index 50c585233f0..92fac87892a 100644 --- a/vortex-array/src/aggregate_fn/proto.rs +++ b/vortex-array/src/aggregate_fn/proto.rs @@ -195,9 +195,8 @@ mod tests { #[test] fn unknown_aggregate_fn_id_allow_unknown() { - let session = VortexSession::empty() - .with::() - .allow_unknown(); + let session = VortexSession::empty().with::(); + session.allow_unknown(); let proto = pb::AggregateFn { id: "vortex.test.foreign_aggregate".to_string(), diff --git a/vortex-array/src/dtype/serde/proto.rs b/vortex-array/src/dtype/serde/proto.rs index 2f992dce591..3147168de90 100644 --- a/vortex-array/src/dtype/serde/proto.rs +++ b/vortex-array/src/dtype/serde/proto.rs @@ -231,6 +231,7 @@ mod tests { use std::sync::Arc; use super::*; + use crate::array_session; use crate::dtype::DType; use crate::dtype::DecimalDType; use crate::dtype::Field; @@ -502,7 +503,8 @@ mod tests { #[test] fn test_unknown_extension_allow_unknown() { - let session = crate::array_session().allow_unknown(); + let session = array_session(); + session.allow_unknown(); let proto = pb::DType { dtype_type: Some(DtypeType::Extension(Box::new(pb::Extension { id: "vortex.test.foreign_ext".to_string(), diff --git a/vortex-array/src/expr/proto.rs b/vortex-array/src/expr/proto.rs index 9f2b81bde84..0a8d71f2954 100644 --- a/vortex-array/src/expr/proto.rs +++ b/vortex-array/src/expr/proto.rs @@ -116,9 +116,8 @@ mod tests { #[test] fn unknown_expression_id_allow_unknown() { - let session = VortexSession::empty() - .with::() - .allow_unknown(); + let session = VortexSession::empty().with::(); + session.allow_unknown(); let expr_proto = pb::Expr { id: "vortex.test.foreign_scalar_fn".to_string(), diff --git a/vortex-session/src/lib.rs b/vortex-session/src/lib.rs index aee36dfbadd..f69dbc8b3ee 100644 --- a/vortex-session/src/lib.rs +++ b/vortex-session/src/lib.rs @@ -96,7 +96,7 @@ mod tests { let session = VortexSession::empty(); assert!(!session.allows_unknown()); - let session = session.allow_unknown(); + session.allow_unknown(); assert!(session.allows_unknown()); } } diff --git a/vortex-session/src/session.rs b/vortex-session/src/session.rs index 9969d0e7281..5745842f3d7 100644 --- a/vortex-session/src/session.rs +++ b/vortex-session/src/session.rs @@ -191,11 +191,11 @@ impl VortexSession { /// Inserts a session variable of type `V`, replacing any existing variable of that type. /// - /// This is the internal copy-on-write insert primitive behind [`with_some`](Self::with_some) and + /// This is the copy-on-write insert primitive behind [`with_some`](Self::with_some) and /// [`get_mut`](SessionExt::get_mut); it is not public, so a variable can only enter the type-map /// through those (or through a default inserted by [`get`](SessionExt::get)). The mutation is /// applied in place to the shared backing store, so it is visible through every clone. - fn register(&self, var: V) { + pub fn register(&self, var: V) { let var: Arc = Arc::new(var); self.0.rcu(|current| { let mut next = SessionVars::clone(current); @@ -246,9 +246,8 @@ impl VortexSession { /// Allow deserializing unknown plugin IDs as non-executable foreign placeholders. /// /// Mutates this session in place and returns it for chaining. - pub fn allow_unknown(self) -> Self { + pub fn allow_unknown(&self) { self.get_mut::().allow_unknown = true; - self } } @@ -435,7 +434,7 @@ mod tests { let session = VortexSession::empty(); assert!(!session.allows_unknown()); - let session = session.allow_unknown(); + session.allow_unknown(); assert!(session.allows_unknown()); } diff --git a/vortex-tui/src/main.rs b/vortex-tui/src/main.rs index cc1e740eb83..f7e4a0e1ff1 100644 --- a/vortex-tui/src/main.rs +++ b/vortex-tui/src/main.rs @@ -8,7 +8,8 @@ use vortex_tui::launch; #[tokio::main] async fn main() -> anyhow::Result<()> { - let session = VortexSession::default().with_tokio().allow_unknown(); + let session = VortexSession::default().with_tokio(); + session.allow_unknown(); if let Err(err) = launch(&session).await { // Defer help/version/usage errors back to clap so their formatting // and exit codes match the standalone-binary convention exactly. diff --git a/vortex-web/crate/src/lib.rs b/vortex-web/crate/src/lib.rs index 03b36ee4515..84e1b1d6004 100644 --- a/vortex-web/crate/src/lib.rs +++ b/vortex-web/crate/src/lib.rs @@ -17,7 +17,7 @@ use vortex::session::VortexSession; mod wasm; static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::default() - .with_handle(WasmRuntime::handle()) - .allow_unknown() + let session = VortexSession::default().with_handle(WasmRuntime::handle()); + session.allow_unknown(); + session });