darpi-rs / darpi

A rust web framework with safety and speed in mind.
https://darpi-rs.github.io/book/
33 stars 1 forks source link

Make FromRequestBody(WithContainer) trait nicer #8

Open petar-dambovaliev opened 3 years ago

petar-dambovaliev commented 3 years ago

https://github.com/rust-lang/rust/issues/29661

The problem: Objects that implement the trait sometimes do not care about the container type. Therefore, it is set to std::any::Any. However, since there are no associated type defaults, there need to be 2 traits. One with a container and one without. There is an implementation of all types that implement the trait without container to implement the trait with container specifying std::any::Any. This could be simplified a lot by having the language feature mentioned above.

petar-dambovaliev commented 3 years ago

Right now it's on nightly. Can be merged when it's on stable.

https://github.com/darpi-rs/darpi/pull/9