Crate actix_xml[][src]

Expand description

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 payload
  • compress(default): enable actix-web compress support

If you’ve removed all compress feature flag for actix-web, make sure to remove compress by setting default-features=false, or a compile error may occur.

Structs

Xml extractor

Request’s payload xml parser, it resolves to a deserialized T value. This future could be used with ServiceRequest and ServiceFromRequest.

XML extractor configuration

Enums

A set of errors that can occur during parsing xml payloads