add support for iron's Request type #13

Closed
gfreezy wants to merge 3 commits from master into master
gfreezy commented 2015-08-02 21:22:02 +12:00 (Migrated from github.com)
No description provided.
mikedilger commented 2015-08-06 08:36:53 +12:00 (Migrated from github.com)

Thanks for the PR.

I'm hesitant to have formdata depend on iron. I'm aware that people are starting to use it with the iron framework, but I personally use it outside of the iron framework.

The fact that Iron uses a different request structure makes it difficult to support. I'm sure there were reasons, but I'm not sure iron's chosen architecture is the right solution.

The Request trait was added to make it possible to use iron requests. However it occurs to me that an impl of that trait must be defined either where the trait is defined (in formdata) or where the struct is defined (in iron), and not in some consumer of both (unless rust language subsequently changed this restriction)

@SkylerLipthay, how are you able to impl the formdata::Request trait for Iron?

If it turns out that there is no better solution, then I'd prefer to wrap iron dependencies under a feature called 'iron' so that those of us not using iron don't have to wait needlessly for iron to compile.

Thanks again. This is certainly something that needs to be sorted out.

Thanks for the PR. I'm hesitant to have formdata depend on iron. I'm aware that people are starting to use it with the iron framework, but I personally use it outside of the iron framework. The fact that Iron uses a different request structure makes it difficult to support. I'm sure there were reasons, but I'm not sure iron's chosen architecture is the right solution. The Request trait was added to make it possible to use iron requests. However it occurs to me that an impl of that trait must be defined either where the trait is defined (in formdata) or where the struct is defined (in iron), and not in some consumer of both (unless rust language subsequently changed this restriction) @SkylerLipthay, how are you able to `impl` the `formdata::Request` trait for Iron? If it turns out that there is no better solution, then I'd prefer to wrap iron dependencies under a feature called 'iron' so that those of us not using iron don't have to wait needlessly for iron to compile. Thanks again. This is certainly something that needs to be sorted out.
mikedilger commented 2015-08-06 08:45:57 +12:00 (Migrated from github.com)

On 2nd thought, perhaps I will dispense with Hyper::Request and just require a &mut S where S: Read, and &Headers separately...

On 2nd thought, perhaps I will dispense with `Hyper::Request` and just require a `&mut S` where `S: Read`, and `&Headers` separately...
mikedilger commented 2015-08-06 09:06:28 +12:00 (Migrated from github.com)

Please see the branch no_request and let me know if this is going to work for you

Please see the branch `no_request` and let me know if this is going to work for you
SkylerLipthay commented 2015-08-07 02:15:55 +12:00 (Migrated from github.com)

Here is my usage of Request: https://github.com/iron/params/blob/master/src/lib.rs#L562

I often employe this wrapper pattern, but it's my least favorite Rust idiom. I really hope we can figure out external-external trait impls at some point!

Here is my usage of `Request`: https://github.com/iron/params/blob/master/src/lib.rs#L562 I often employe this wrapper pattern, but it's my least favorite Rust idiom. I really hope we can figure out external-external trait impls at some point!
gfreezy commented 2015-08-07 03:30:27 +12:00 (Migrated from github.com)

@mikedilger no_request works great for me. @SkylerLipthay thanks for params. It is what i wanted to make.

@mikedilger `no_request` works great for me. @SkylerLipthay thanks for `params`. It is what i wanted to make.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mikedilger/formdata!13
No description provided.