Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable use of multiple value types per field #882

Merged
merged 7 commits into from
Dec 18, 2020

Conversation

untitaker
Copy link
Member

@untitaker untitaker commented Dec 9, 2020

Add ability to assign multiple value types to a protocol type. For example (part of the patch):

#[metastructure(value_type = "Message", value_type = "String")]

This allows us to fix a long-standing issue with logentry.formatted,
which is supposed to be addressible by $string as well as
$logentry.formatted as well as $message.

It also makes a bit of code in minidump attachment processing simpler,
and removes an obstacle in introducing valuetypes in a
backwards-compatible manner.

For future consideration we may change the behavior of the derive on
newtypes to append to the list of valuetypes rather than replace them,
such that the actual syntactic change in logentry.rs is not necessary
(as the Message wraps a String already). Similarly one could make all
structs-with-fields addressible under $object.

This allows us to fix a long-standing issue with logentry.formatted,
which is supposed to be addressible by $string as well as
$logentry.formatted as well as $message.

It also makes a bit of code in minidump attachment processing simpler,
and removes an obstacle in introducing valuetypes in a
backwards-compatible manner.

For future consideration we may change the behavior of the derive on
newtypes to *append* to the list of valuetypes rather than replace them,
such that the actual syntactic change in logentry.rs is not necessary
(as the Message wraps a String already). Similarly one could make all
structs-with-fields addressible under $object.
@untitaker untitaker requested a review from a team December 9, 2020 16:56
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more accepted way for writing the annotation would be:

#[metastructure(value_types = ["string", "message"])]

nit: You have value_type variables in many places now where in fact an iterator or set is passed. These should probably be called value_types.

@untitaker untitaker merged commit 33f0dfb into master Dec 18, 2020
@untitaker untitaker deleted the feat/multiple-value-types branch December 18, 2020 08:55
jan-auer added a commit that referenced this pull request Dec 18, 2020
* master:
  feat: Enable use of multiple value types per field (#882)
  fix(user-report): Make all fields but event-id optional (#886)
  release: 20.12.1
  release: 20.12.0
  ci(release): Move to getsentry/publish for releases (#885)
  meta: Fix CODEOWNERS (#884)
  fix: Also build rdkafka with ssl if ssl feature is enabled (#881)
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.

2 participants