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

deserialize_identifier: add support for all types expected by serde #8

Merged

Conversation

sosthene-nitrokey
Copy link
Contributor

@sosthene-nitrokey sosthene-nitrokey commented Feb 12, 2024

The default serde deserialize derive accepts 3 types for identifiers:

  • The name of the field as str
  • The name of the field as ascii bytes
  • The index of the field as u64

This PR changes deserialize_identifier to have compatibility with all of these
This is necessary for Nitrokey/fido-authenticator#57,
which needs compatibility with both the str variant and the index variant

Built on top of #7

sosthene-nitrokey and others added 2 commits October 7, 2024 10:25
The default serde deserialize derive accepts 3 types for identifiers:

- The name of the field as `str`
- The name of the field as ascii bytes
- The index of the field as u64

This PR changes deserialize_identifier to have compatibility with all of these
This is necessary for Nitrokey/fido-authenticator#57,
which needs compatibility with both the str variant and the index variant
Previously, we visited either strings or bytes so that the visitor had
to handle both cases.  With this change, we always visit strings so that
the bytes visitor function can be optimized out. This significantly
reduces binary size.
@sosthene-nitrokey sosthene-nitrokey merged commit 2ba6ee3 into trussed-dev:main Oct 7, 2024
1 check passed
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