Crates.io | actix-multipart-derive-impl |
lib.rs | actix-multipart-derive-impl |
version | 0.1.0 |
source | src |
created_at | 2020-11-09 00:32:44.298579 |
updated_at | 2020-11-09 00:32:44.298579 |
description | Procedural derive macro implementation for actix-multipart-derive. |
homepage | |
repository | https://github.com/robjtede/actix-multipart-derive.git |
max_upload_size | |
id | 310133 |
size | 8,926 |
WIP derive macro wrapping
actix-multipart
to make multipart forms easier to consume.
Consuming multipart forms should be expressive while maintaining it's stream-oriented implementation under the hood.
use actix_multipart_derive::MultipartForm;
use actix_web::{post, web::BytesMut, App, HttpServer};
#[derive(Debug, Clone, Default, MultipartForm)]
struct Form {
name: String,
#[multipart(max_size = 1024)]
file: BytesMut,
}
#[post("/")]
async fn index(form: Form) -> &'static str {
println!("{:?}", &form);
"Hello world!\r\n"
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(index))
.bind("127.0.0.1:8080")?
.workers(1)
.run()
.await
}