actix-multipart-derive-impl

Crates.ioactix-multipart-derive-impl
lib.rsactix-multipart-derive-impl
version0.1.0
sourcesrc
created_at2020-11-09 00:32:44.298579
updated_at2020-11-09 00:32:44.298579
descriptionProcedural derive macro implementation for actix-multipart-derive.
homepage
repositoryhttps://github.com/robjtede/actix-multipart-derive.git
max_upload_size
id310133
size8,926
Rob Ede (robjtede)

documentation

README

actix-multipart-derive

WIP derive macro wrapping actix-multipart to make multipart forms easier to consume.

Goal

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
}

Commit count: 5

cargo fmt