redbadger / crux

Cross-platform app development in Rust
https://redbadger.github.io/crux/
Apache License 2.0
1.77k stars 66 forks source link

[Request] Using `http` crate types for `Response` etc. #285

Open m00nwtchr opened 2 weeks ago

m00nwtchr commented 2 weeks ago

I'm using several other crates that are meant to interoperate with the types provided by the http crate, which makes using them with crux_http difficult. Using the semi-standard Response/Request/etc. types from the http crate in crux would rectify that. Alternatively, Into/From implementations could provide a good enough experience via conversions (ideally non-copying).

charypar commented 2 weeks ago

This is definitely on our to-do list, but it would be quite a breaking change to crux_http, and will make providing a smooth migration path quite tricky.

It's likely we will first release a http compatible alternative capability, and then migrate crux_http.

On the Into / From front, that sounds like good short term patch. Would you be interested in trying? We'd welcome a PR.

m00nwtchr commented 2 weeks ago

Sure.

m00nwtchr commented 2 weeks ago

Just noticed that the "http" name in crux_http is actually an alias of http-types, which is a different http "base-crate" from http. To be clear, do you mean that you want to eventually switch to http (and so I should focus on bringing in compatibility with that, directly), or are you going to more fully embrace http-types?

(My original problem requires compatibility with http, but http-types has conversion implementations for http already, so I can go crux_http -> http-types -> http)

m00nwtchr commented 2 weeks ago

@charypar

charypar commented 1 week ago

Yes, we do want to eventually switch to http as the base types crate, but we expose a fair bit of http-types in the public API of crux_http, so the change is pretty major. IIRC so much so that it's basically a total rewrite of the core-facing public API, and possibly even the FFI interface.