pub trait InPlaceTransform: Send + Sync {
// Required method
fn transform(
&self,
table: &str,
id: &mut Value,
fields: Option<&mut HashMap<String, Value>>,
) -> Result<()>;
// Provided methods
fn transform_row(&self, row: &mut Row) -> Result<()> { ... }
fn transform_change(&self, change: &mut Change) -> Result<()> { ... }
fn transform_relation(&self, _relation: &mut Relation) -> Result<()> { ... }
fn transform_relation_change(
&self,
_change: &mut RelationChange,
) -> Result<()> { ... }
fn transform_rows_inplace(&self, rows: &mut [Row]) -> Result<()> { ... }
fn transform_changes_inplace(&self, changes: &mut [Change]) -> Result<()> { ... }
fn transform_relations_inplace(
&self,
relations: &mut [Relation],
) -> Result<()> { ... }
fn transform_relation_changes_inplace(
&self,
changes: &mut [RelationChange],
) -> Result<()> { ... }
}Expand description
Mutate-only, same-length transform over sync docs.
This is the only in-process mutation primitive. Filter / fan-out belong in an external transform or outside this trait.
Implement transform once for the shared document surface
(table / id / optional fields). transform_row
and transform_change default to calling it.
Deletes arrive with fields == None.
§Slice defaults
transform_rows_inplace and
transform_changes_inplace loop over
items by default. Override only when a batched implementation is faster.
Relation methods default to no-op so row-only transforms stay trivial.
Required Methods§
Provided Methods§
Sourcefn transform_row(&self, row: &mut Row) -> Result<()>
fn transform_row(&self, row: &mut Row) -> Result<()>
Transform a single row in place.
Sourcefn transform_change(&self, change: &mut Change) -> Result<()>
fn transform_change(&self, change: &mut Change) -> Result<()>
Transform a single change in place (including deletes).
Sourcefn transform_relation(&self, _relation: &mut Relation) -> Result<()>
fn transform_relation(&self, _relation: &mut Relation) -> Result<()>
Transform a single relation in place. Default: no-op.
Sourcefn transform_relation_change(&self, _change: &mut RelationChange) -> Result<()>
fn transform_relation_change(&self, _change: &mut RelationChange) -> Result<()>
Transform a single relation change in place. Default: no-op.
Sourcefn transform_rows_inplace(&self, rows: &mut [Row]) -> Result<()>
fn transform_rows_inplace(&self, rows: &mut [Row]) -> Result<()>
Transform a slice of owned rows in place (true zero-copy path).
Sourcefn transform_changes_inplace(&self, changes: &mut [Change]) -> Result<()>
fn transform_changes_inplace(&self, changes: &mut [Change]) -> Result<()>
Transform a slice of owned changes in place (true zero-copy path).
Sourcefn transform_relations_inplace(&self, relations: &mut [Relation]) -> Result<()>
fn transform_relations_inplace(&self, relations: &mut [Relation]) -> Result<()>
Transform a slice of owned relations in place. Default: loop.
Sourcefn transform_relation_changes_inplace(
&self,
changes: &mut [RelationChange],
) -> Result<()>
fn transform_relation_changes_inplace( &self, changes: &mut [RelationChange], ) -> Result<()>
Transform a slice of owned relation changes in place. Default: loop.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".