File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,8 @@ pub fn vortex_session::VortexSession::empty() -> Self
114114
115115pub fn vortex_session::VortexSession::with<V: vortex_session::SessionVar + core::default::Default>(self) -> Self
116116
117+ pub fn vortex_session::VortexSession::with_some<V: vortex_session::SessionVar>(self, var: V) -> Self
118+
117119impl core::clone::Clone for vortex_session::VortexSession
118120
119121pub fn vortex_session::VortexSession::clone(&self) -> vortex_session::VortexSession
Original file line number Diff line number Diff line change @@ -39,6 +39,15 @@ impl VortexSession {
3939 ///
4040 /// If a variable of that type already exists.
4141 pub fn with < V : SessionVar + Default > ( self ) -> Self {
42+ self . with_some ( V :: default ( ) )
43+ }
44+
45+ /// Inserts a new session variable of type `V`.
46+ ///
47+ /// # Panics
48+ ///
49+ /// If a variable of that type already exists.
50+ pub fn with_some < V : SessionVar > ( self , var : V ) -> Self {
4251 match self . 0 . entry ( TypeId :: of :: < V > ( ) ) {
4352 Entry :: Occupied ( _) => {
4453 vortex_panic ! (
@@ -47,7 +56,7 @@ impl VortexSession {
4756 ) ;
4857 }
4958 Entry :: Vacant ( e) => {
50- e. insert ( Box :: new ( V :: default ( ) ) ) ;
59+ e. insert ( Box :: new ( var ) ) ;
5160 }
5261 }
5362 self
You can’t perform that action at this time.
0 commit comments