Skip to content

feat: seq deserialization support for wildcard path#3680

Open
sirreidlos wants to merge 3 commits intotokio-rs:mainfrom
sirreidlos:vec-string-path-extractor
Open

feat: seq deserialization support for wildcard path#3680
sirreidlos wants to merge 3 commits intotokio-rs:mainfrom
sirreidlos:vec-string-path-extractor

Conversation

@sirreidlos
Copy link

Motivation

Closes #3621

Personally came across the need for the same feature recently, and seeing that nobody has taken it upon themselves to add the feature, I decided to do it myself.

Solution

Add ValueSeqDeserializer for both PathDeserializer and ValueDeserializer's deserialize_seq. Some code for the ValueDeserializer is also duplicated to create a deserializer that can take in raw strs, aptly named RawStrValueDeserializer.

Other solutions were explored, for example building a PercentDecodedStr directly from a str, but the lifetime constraint made it impossible. Another was simply to run the decoding function again, but the (potential, unmeasured) runtime performance hit may be too off-putting.

Deserialization for a single-param sequence now always goes through ValueSeqDeserializer. This is mostly transparent, with one exception where the error type is changed from Message("Unexpected key type") to UnsupportedType as reflected in the modified test_parse_seq_tuple_unsupported_key_type.

`deserialize_seq` for a single param now unconditionally uses
`ValueSeqDeserializer`, altering the error kind for types like
`Vec<(u32, String)>` from `Message("Unexpected key type")` to
`UnsupportedType`. This is captured in
`test_parse_seq_tuple_unsupported_key_type`. No clean way to distinguish
wildcard-captured params from regular ones within the deserializer alone
was found without invasive changes upstream.
@sirreidlos sirreidlos force-pushed the vec-string-path-extractor branch from a645ee9 to 39a6669 Compare March 11, 2026 13:13
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.

Path extractor Vec<String> deserialization support for wildcard paths

1 participant