Ogeon / rustful

[OUTDATED] A light HTTP framework for Rust
https://docs.rs/rustful
Apache License 2.0
862 stars 52 forks source link

Implement a Parameters type #56

Closed Ogeon closed 9 years ago

Ogeon commented 9 years ago

This PR adds a Patameters type that extends HashMap with helpful parsing methods. This allows parameters to easily be parsed as any type T: FromStr without repeating map(|v| v.parse().ok()) or anything similar.

Part of the purpose of this PR is to see how sane it is to implement this as a separate type, instead of a trait. Thoughts, ideas and feedback are most welcome.

This replaces some occurrences of HashMap with Parameters, which makes it a breaking change.

Closes #55

homu commented 9 years ago

:umbrella: The latest upstream changes (presumably #58) made this pull request unmergeable. Please resolve the merge conflicts.

Ogeon commented 9 years ago

I like this. I think I will keep it. What do you think, @tmmcguire?

tmmcguire commented 9 years ago

Sorry I've been out of touch lately, I was out of town and then head-down on a only-semi-related project.

I like it! I'd say it looks exactly like what I was thinking of, but I think it does things better than what I had in mind. Thanks!

Ogeon commented 9 years ago

Great! I'll just push some other changes I have in store and before merging this on top of them. I have decided to give parts of the request parsing a makeover to preserve more of the original data and it will most likely conflict with this.

Ogeon commented 9 years ago

It turned out to be worse than expected. I'll merge this first.

@homu r+

homu commented 9 years ago

:pushpin: Commit 440ffd7 has been approved by Ogeon

homu commented 9 years ago

:hourglass: Testing commit 440ffd7 with merge eb699b7...

homu commented 9 years ago

:sunny: Test successful - status