Skip to content

Conversation

@sunshowers
Copy link
Contributor

Similar to TypedBody::map, and particularly useful for type conversions across API versions.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
pub fn map<T, F>(self, f: F) -> TypedBody<T>
where
T: JsonSchema + DeserializeOwned + Send + Sync,
F: Fn(BodyType) -> T,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need for this to be Fn since it's called just once -- FnOnce is more general.

@sunshowers sunshowers merged commit 47a2a28 into main Dec 10, 2025
11 checks passed
@sunshowers sunshowers deleted the sunshowers/spr/add-map-and-try_map-to-other-extractors-and-response-types branch December 10, 2025 00:21
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.

3 participants