scylla::serialize::row

Function serialize_legacy_row

Source
pub fn serialize_legacy_row<T>(
    r: &T,
    ctx: &RowSerializationContext<'_>,
    writer: &mut RowWriter<'_>,
) -> Result<(), SerializationError>
where T: ValueList,
Expand description

Serializes an object implementing ValueList by using the RowWriter interface.

The function first serializes the value with ValueList::serialized, then parses the result and serializes it again with given RowWriter. In case or serialized values with names, they are converted to serialized values without names, based on the information about the bind markers provided in the RowSerializationContext.

It is a lazy and inefficient way to implement RowWriter via an existing ValueList impl.

Returns an error if ValueList::serialized call failed or, in case of named serialized values, some bind markers couldn’t be matched to a named value.

See impl_serialize_row_via_value_list which generates a boilerplate SerializeRow implementation that uses this function.