Skip to content

serde: add stringify serializer over generic T:Display#340

Merged
apoelstra merged 1 commit intoBlockstreamResearch:masterfrom
trevarj:serde-stringify
Feb 28, 2026
Merged

serde: add stringify serializer over generic T:Display#340
apoelstra merged 1 commit intoBlockstreamResearch:masterfrom
trevarj:serde-stringify

Conversation

@trevarj
Copy link
Contributor

@trevarj trevarj commented Feb 6, 2026

  • Added a crate serde module and re-exported external serde crate from within it
  • Added a simplicity::serializers::stringify module that contains a generic serializer
    over T: Display, which can be used with
    #[serde(with = "simplicity::serializers::stringify")] over a struct field
  • Added a unit test that uses string values from Value's value_display test

Resolves #330

@apoelstra
Copy link
Collaborator

CI failures are because the lockfile is not updated.

@trevarj
Copy link
Contributor Author

trevarj commented Feb 20, 2026

Forced push with changing the module to simplicity::serializers::stringify and addressed the other feedback comments

- Added a crate `serializers` module
- Added a simplicity::serializers::stringify module that contains a generic serializer
  over T: Display, which can be used with
  #[serde(with = "simplicity::serializers::stringify")] over a struct field
- Added a unit test that uses string values from Value's `value_display` test
- Updated Cargo-recent.lock to add serde_json

Resolves BlockstreamResearch#330
@trevarj
Copy link
Contributor Author

trevarj commented Feb 28, 2026

Embarrassingly did another force push to fix test (forgot to change module name serde -> serializers)

Copy link
Collaborator

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK a5f99ef; successfully ran local tests

@apoelstra apoelstra merged commit a7d67c7 into BlockstreamResearch:master Feb 28, 2026
24 checks 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.

Should have serde module for encoding values as strings

2 participants