Conversions between the native rama-http-types types and the hyperium
http crate equivalents, for interop with the wider http/tower/hyper
ecosystem.
rama-http-types is http-free; this crate is the opt-in bridge, exposed as
two sealed, fallible extension traits: [TryIntoHyperiumHttp]
(rama → http) and [TryIntoRamaHttp] (http → rama). They are local
traits, so they implement the foreign http types directly (no orphan rule,
no conversion marker) and are callable as plain methods.
The conversions are fallible by design: an invalid method/status, an
unrepresentable URI, or an invalid header name/value is surfaced as an error
(the direction's natural catch-all — [http::Error] one way,
[rama_http_types::Error] the other) rather than silently coerced.
Bodies are bridged (not copied) by [HyperiumBody] / [RamaBody], which
wrap rama's Body ↔ the external
[http_body::Body], converting only trailer frames.
use ;
let hyper_req = builder.uri.body.unwrap;
let rama_req: Request = hyper_req.try_into_rama_http.unwrap;
assert_eq!;
let back: Request = rama_req.try_into_hyperium_http.unwrap;
assert_eq!;