3 unstable releases
0.2.0 | Feb 26, 2022 |
---|---|
0.2.0-beta.0 | Jul 11, 2021 |
0.1.1 | Jul 11, 2021 |
0.1.0 |
|
#41 in #extractor
39 downloads per month
22KB
400 lines
actix-xml
XML extractor for actix-web.
This crate provides struct Xml
that can be used to extract typed information from request's body.
Under the hood, quick-xml is used to parse payloads.
Example
use actix_web::{web, App};
use actix_xml::Xml;
use serde::Deserialize;
#[derive(Deserialize)]
struct Info {
username: String,
}
/// deserialize `Info` from request's body
async fn index(info: Xml<Info>) -> String {
format!("Welcome {}!", info.username)
}
fn main() {
let app = App::new().service(
web::resource("/index.html").route(
web::post().to(index))
);
}
Features
encoding
: support non utf-8 payloadcompress-brotli
(default): enable actix-webcompress-brotli
supportcompress-gzip
(default): enable actix-webcompress-gzip
supportcompress-zstd
(default): enable actix-webcompress-zstd
support
If you've removed one of the compress-*
feature flag for actix-web, make sure to remove it by
setting default-features=false
, or it will be re-enabled for actix-web.
Version Support
0.1.x
- supportsactix-web 3.3.x
0.2.0-beta.0
- supportsactix-web 4.0.0.beta.8
0.2.0
- supportsactix-web 4.0.x
License
MIT
Dependencies
~16–28MB
~501K SLoC