Skip to content

Introduce UpdateField trait to generalize field transformation in partial data#148

Merged
soareschen merged 11 commits intomainfrom
update-field
Sep 12, 2025
Merged

Introduce UpdateField trait to generalize field transformation in partial data#148
soareschen merged 11 commits intomainfrom
update-field

Conversation

@soareschen
Copy link
Collaborator

@soareschen soareschen commented Sep 12, 2025

Summary

This PR introduces a new UpdateField trait that generalizes the update operation for partial record fields:

pub trait UpdateField<Tag, M: MapType> {
    type Value;

    type Mapper: MapType;

    type Output;

    fn update_field(
        self,
        _tag: PhantomData<Tag>,
        value: M::Map<Self::Value>,
    ) -> (<Self::Mapper as MapType>::Map<Self::Value>, Self::Output);
}

This generalizes the field update operations of inserting field values or taking out field values. With this, traits like BuildField, TakeField, and TransformMapFields can be implemented as blanket implementations on UpdateField, instead of being derived explicitly by the proc macros.

@soareschen soareschen merged commit 985092d into main Sep 12, 2025
5 checks passed
@soareschen soareschen deleted the update-field branch September 12, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant