Http crate From<[u8]> or From<String>


Hi all,

I was wondering why the http crate doesn’t implement From<T> crate, specially for String or [u8] ?

Am I missing something here?

I’d like to convert a http request to a Request structure. Like GET HTTP/1.1 to a Request with method, headers,…

Any idea?


As explained in the documentation, the http crate is not an HTTP parser/serializer. It’s for inter-crate interoperability by defining structures common to HTTP.


Ok so I need to implement it myself.


You can probably leverage one of these crates to do it for you: