pub struct CowBatch<T> {
pub items: Vec<Arc<T>>,
}Expand description
Batch of Arc-shared items with copy-on-write mutation via Arc::make_mut.
Prefer owned Vec + InPlaceTransform::transform_rows_inplace /
InPlaceTransform::transform_changes_inplace when sharing is not required.
Use CowBatch only when the same items may be shared across holders and
mutation must not affect other owners.
§Cost of apply_inplace
Self::apply_inplace always calls Arc::make_mut before invoking the
transform. When an item’s strong count is greater than one, make_mut
clones even if the transform is a no-op (e.g. crate::pipeline::Passthrough).
Unique arcs (refcount 1) are mutated without allocation regardless of whether
the transform writes.
Fields§
§items: Vec<Arc<T>>Shared items; mutated through Arc::make_mut in Self::apply_inplace.
Implementations§
Source§impl<T> CowBatch<T>
impl<T> CowBatch<T>
Sourcepub fn from_owned(items: Vec<T>) -> Self
pub fn from_owned(items: Vec<T>) -> Self
Create a batch by wrapping each owned item in a fresh Arc (refcount 1).
Sourcepub fn into_items(self) -> Vec<Arc<T>>
pub fn into_items(self) -> Vec<Arc<T>>
Consume the batch, returning the underlying Arcs.
Source§impl CowBatch<Row>
impl CowBatch<Row>
Sourcepub fn apply_inplace(&mut self, t: &impl InPlaceTransform) -> Result<()>
pub fn apply_inplace(&mut self, t: &impl InPlaceTransform) -> Result<()>
Apply an in-place transform with Arc COW semantics.
Always calls Arc::make_mut per item. Clones when the arc is shared
(strong count > 1), including when t is a no-op such as
crate::pipeline::Passthrough. Unique arcs are mutated without allocation.
Source§impl CowBatch<Change>
impl CowBatch<Change>
Sourcepub fn apply_inplace(&mut self, t: &impl InPlaceTransform) -> Result<()>
pub fn apply_inplace(&mut self, t: &impl InPlaceTransform) -> Result<()>
Apply an in-place transform with Arc COW semantics.
Always calls Arc::make_mut per item. Clones when the arc is shared
(strong count > 1), including when t is a no-op such as
crate::pipeline::Passthrough. Unique arcs are mutated without allocation.
Source§impl CowBatch<Relation>
impl CowBatch<Relation>
Sourcepub fn apply_inplace(&mut self, t: &impl InPlaceTransform) -> Result<()>
pub fn apply_inplace(&mut self, t: &impl InPlaceTransform) -> Result<()>
Apply an in-place transform with Arc COW semantics for relations.