Skip to content

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

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

apoelstra merged 1 commit into
BlockstreamResearch:masterfrom
trevarj:serde-stringify

Conversation

@trevarj

@trevarj trevarj commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor
  • 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

Comment thread src/serde/mod.rs Resolved
Comment thread Cargo.toml Resolved
@apoelstra

Copy link
Copy Markdown
Collaborator

CI failures are because the lockfile is not updated.

@trevarj

trevarj commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/bit_encoding/encode.rs Resolved
- 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

trevarj commented Feb 28, 2026

Copy link
Copy Markdown
Contributor Author

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

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Collaborator

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