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


#1

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://www.w3.org/pub/WWW/TheProject.html HTTP/1.1 to a Request with method, headers,…

Any idea?


#2

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.


#3

Ok so I need to implement it myself.


#4

You can probably leverage one of these crates to do it for you: https://crates.io/crates/http/reverse_dependencies