6 个版本
| 0.2.3 | 2022年11月7日 | 
|---|---|
| 0.2.2 | 2022年9月12日 | 
| 0.1.1 | 2022年7月6日 | 
在 #deserializing 中排名第 24
每月下载量 35
用于 async-xml
47KB
 1K  SLoC
async-xml
基于 tokio 和 quick-xml 的 crate,用于异步反序列化 XML 数据。包括用于反序列化内容的衍生产生宏。
示例
use async_xml::from_str;
use async_xml_derive::FromXml;
#[tokio::main]
async fn main() {
    let report: Report = from_str(r#"<report id="b"><data>text</data></report>"#)
        .await
        .unwrap();
    println!("deserialized: {:?}", report);
	// prints "Report { id: "b", data: Some(ReportData { data: "text" }) }"
}
#[derive(Debug, PartialEq, FromXml)]
#[async_xml(rename = "report")]
pub struct Report {
    #[async_xml(attribute)]
    pub id: String,
    #[async_xml(child)]
    pub data: Option<ReportData>,
}
#[derive(Debug, PartialEq, FromXml)]
#[async_xml(rename = "data")]
pub struct ReportData {
    #[async_xml(value)]
    pub data: String,
}
许可协议
许可协议为以下之一
- Apache 许可协议 2.0 (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可协议 (LICENSE-MIT 或 https://open-source.org.cn/licenses/MIT)
任选其一。
贡献
除非您明确声明,否则您有意提交以供包含在 Apache-2.0 许可证定义的分支中的任何贡献,将根据上述方式双重许可,而无需任何额外条款或条件。
依赖项
~1.5MB
~34K SLoC