Skip to content

kcking/actix-multipart-derive

 
 

Repository files navigation

actix-multipart-derive

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

crates.io Documentation Apache 2.0 or MIT licensed Dependency Status

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
}

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%