Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Can you help me figure how to make this work with Rust 2018? #142

Description

@wpd

I know that this crate is in passive maintenance mode, but I care more about space than I do about performance for a web server that is going into an embedded device with very little memory. So I don't want to add the overhead of asyncio.

I am trying to incorporate multipart into my project with:

fn firmware_update_action(mut request: tiny_http::Request, handlebars: &Handlebars) {
    match Multipart::from_request(&mut request) {
        Ok(mut multipart) => {}
        Err(_) => {
            //not_found(request, handlebars);
            return;
        }
    }

but, when I compile (with Rust 1.51, 2018 edition), I get the following error:

error[E0277]: the trait bound `&mut tiny_http::Request: multipart::server::HttpRequest` is not satisfied
   --> src/server.rs:157:35
    |
157 |     match Multipart::from_request(&mut request) {
    |                                   ^^^^^^^^^^^^ the trait `multipart::server::HttpRequest` is not implemented for `&mut tiny_http::Request`
    | 
   ::: /Users/wpd/.cargo/registry/src/github.com-1ecc6299db9ec823/multipart-0.18.0/src/server/mod.rs:87:28
    |
87  |     pub fn from_request<R: HttpRequest>(req: R) -> Result<Multipart<R::Body>, R> {
    |                            ----------- required by this bound in `multipart::server::Multipart::<()>::from_request`

error[E0277]: the trait bound `&mut tiny_http::Request: multipart::server::HttpRequest` is not satisfied
   --> src/server.rs:157:11
    |
157 |     match Multipart::from_request(&mut request) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^ the trait `multipart::server::HttpRequest` is not implemented for `&mut tiny_http::Request`

Can you help me figure out how to address this?

I have this in my Cargo.toml file:

multipart = { version = "0.18.0", features = ["server", "tiny_http" ] }

Part of the reason I chose to implement this server in Rust was to give myself a real life project which I could use to sink my teeth into Rust. So I am stil learning about the language, but this one has me stumped.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions