You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move extension type construction logic out of Field (#9266)
# Which issue does this PR close?
- Part of #8987
# Rationale for this change
The logic to instantiate a type extension does not really depend on
`Field`, other than indirectly because that struct happens to contain
all the necessary bits of information.
As part of the work to make the JSON decoder support extension types, it
was
[observed](#9021 (comment))
that a field is not always available (or at least, not desirable because
it creates redundancy). This change addresses the concern by making it
possible to work directly with extension types instead of being forced
to route through a `Field` instance.
# What changes are included in this PR?
Factor out the body of `Field::try_extension_type` as a new associated
function `ExtensionType::try_new_from_field_metadata` that takes data
type and field metadata map and delegates to `ExtensionType::try_new`.
`Field::try_extension_type` then simply calls that new method.
# Are these changes tested?
Code movement. Existing unit tests validate it.
# Are there any user-facing changes?
New provided trait method.
0 commit comments