pub struct CteRegistry { /* private fields */ }Expand description
Registry for CTE results during query execution
Uses Arc with COW (copy-on-write) semantics to avoid cloning:
- During building:
Arc::make_mutgives mutable access without cloning (single owner) - During sharing:
data()returns cheap Arc clone (O(1), no data copy)
Implementations§
Source§impl CteRegistry
impl CteRegistry
Sourcepub fn store(&mut self, name: &str, columns: Vec<String>, rows: RowVec)
pub fn store(&mut self, name: &str, columns: Vec<String>, rows: RowVec)
Store a materialized CTE result
Uses Arc::make_mut for COW semantics:
- If we’re the only owner, mutates in place (no clone)
- If shared, clones first then mutates (preserves other references)
Both columns and rows are wrapped in Arc to enable zero-copy sharing. Accepts RowVec and converts to CompactArc<Vec<(i64, Row)>> for sharing.
Sourcepub fn store_arc(
&mut self,
name: &str,
columns: CompactArc<Vec<String>>,
rows: CompactArc<Vec<(i64, Row)>>,
materialized_rows: Arc<OnceLock<CompactArc<Vec<Row>>>>,
)
pub fn store_arc( &mut self, name: &str, columns: CompactArc<Vec<String>>, rows: CompactArc<Vec<(i64, Row)>>, materialized_rows: Arc<OnceLock<CompactArc<Vec<Row>>>>, )
Store a materialized CTE result with pre-wrapped Arcs
Use this when you already have Arc-wrapped data to avoid cloning. This enables zero-copy sharing of CTE results between queries.
Sourcepub fn get(&self, name: &str) -> Option<&CteData>
pub fn get(&self, name: &str) -> Option<&CteData>
Look up a materialized CTE by case-insensitive name.
Sourcepub fn data(&self) -> Arc<CteDataMap> ⓘ
pub fn data(&self) -> Arc<CteDataMap> ⓘ
Get a shared Arc reference to the internal data map for context transfer
This is always O(1) - just an Arc reference count increment. No data cloning ever happens here.
Trait Implementations§
Source§impl Clone for CteRegistry
impl Clone for CteRegistry
Source§fn clone(&self) -> CteRegistry
fn clone(&self) -> CteRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CteRegistry
impl RefUnwindSafe for CteRegistry
impl Send for CteRegistry
impl Sync for CteRegistry
impl Unpin for CteRegistry
impl UnsafeUnpin for CteRegistry
impl UnwindSafe for CteRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more