Expand description
This crate provides a typed extractor for multipart/form-data requests in poem, in a
rust-native manner.
§Usage
To use this crate, either implement FromMultiPart for your structure, or use the
poem_typed_multipart_macro::FromMultiPart macro. Then use the TypedMultiPart extractor
in your endpoint.
use poem_typed_multipart::{TypedMultiPart, FromMultiPart}
#[derive(Debug, FromMultiPart)]
struct Body {
id: u32,
title: String
}
#[poem::handler]
fn hello(TypedMultiPart(body): TypedMultiPart<Body>) -> String {
println!("{body:?}");
format!("Hello {}", body.title)
}§Extending this crate to your types
All types implementing part::FromMultiPartPart can be used to can be extracted using this
crate. Check the existing implementation on details how to implement these yourself.
§Features
json: Extract json values using the [part::Json] type.bytes: Support for [bytes::Bytes].
Modules§
- map
- Utility map used to build the request object
- part
- Implementations for the
FromMultiPartParttrait
Structs§
- Typed
Multi Part - Extractor used to get value
Tfrom the request. This consumes the request
Traits§
- From
Multi Part - Trait implement indicating that the implement can be parsed from a multipart request