You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
I've tried to implement this module in a fresh API, written in rust, but I can't get it to compile successfully. If I could get it to run, I would write an example integration for nickel in this project.
Maybe, there's a typo anywhere?
Cargo.toml
[package]
authors = ["Sebastian Blei <...>"]
name = "try_multipart"version = "0.1.0"
[[bin]]
doc = falsename = "multipart"
[dependencies.multipart]
version = "0.7"# Maybe a typo, because in the source code is a `nickel` cfg feature flag, NOT A `nickel_` (with underscore)features = ["nickel", "nickel_"]
multipart.rs
#[macro_use]externcrate nickel;externcrate hyper;externcrate multipart;use multipart::server::{Entries,Multipart,SaveResult};use multipart::server::nickel as nickel_;use nickel::{Nickel,HttpRouter,MiddlewareResult,Request,Response};// Try integration as full fn.fnhandle_post<'mw>(req:&mutRequest,mutres:Response<'mw>) -> MiddlewareResult<'mw>{matchMultipart::from_request(req){Ok(mut multipart) => res.send("Ok"),Err(_) => res.send("error"),}}fnmain(){letmut srv = Nickel::new();
srv.post("/multipart/",middleware!{ |req, res|
matchMultipart::from_request(req){Ok(mut multipart) => "upload is multipart",
Err(_) => "error",
}});// Try integration via macro.// Macro and declared fn (handle_post) will be actually result in a similliar fn.
srv.post("/alternative_multipart/", handle_post);
srv.listen("127.0.0.1:6868");}
cargo run --bin multipart will result in:
❯ cargo run --bin multipart
Compiling try_multipart v0.1.0 (file:///home/sblei/Projects/macsi-rust-api)
src/bin/main.rs:62:11: 62:34 error: the trait bound `&mut nickel::Request<'_, '_>: multipart::server::HttpRequest` is not satisfied [E0277]
src/bin/main.rs:62 match Multipart::from_request(req) {
^~~~~~~~~~~~~~~~~~~~~~~
src/bin/main.rs:62:11: 62:34 help: run `rustc --explain E0277` to see a detailed explanation
src/bin/main.rs:62:11: 62:34 note: required by `multipart::server::Multipart::from_request`
error: aborting due to previous error
error: Could not compile `diesel_pg_test`.
To learn more, run the command again with --verbose.
Thanks in advance for your help.
The text was updated successfully, but these errors were encountered:
You don't write what version of Nickel you have in your Cargo.toml. If it doesn't match Multipart's, you'll get this error.
Also, the nickel_ feature implies nickel; the underscored feature is to make sure Hyper is activated as well since Nickel doesn't reexport Hyper's Request type. That's also what's blocking the upgrade to Hyper 0.9.
I've tried to implement this module in a fresh API, written in rust, but I can't get it to compile successfully. If I could get it to run, I would write an example integration for nickel in this project.
Maybe, there's a typo anywhere?
Cargo.toml
multipart.rs
cargo run --bin multipart
will result in:Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: