【发布时间】:2021-01-02 23:30:18
【问题描述】:
我正在尝试使用quick_xml::se::to_string 函数。这似乎是一个公共函数,因为它是in the publicly available docs, 在quick_xml 源中被标记为pub,并且似乎是work fine in the quick_xml unit tests。这是我的代码:
use quick_xml::se::to_string as xml_to_string;
use serde::{Serialize};
#[derive(Debug, Serialize, Clone)]
struct ApiError<'a> {
code: &'a str,
}
fn main() {
xml_to_string(ApiError { code: "foo" })
}
但是,这失败了
error[E0432]: unresolved import `quick_xml::se`
--> src/main.rs:1:16
|
1 | use quick_xml::se::to_string as xml_to_string;
| ^^ could not find `se` in `quick_xml`
我尝试了其他几种导入此函数的方法(use quick_xml;、use quick_xml::se::to_string),但似乎无论如何,我都会遇到同样的错误。这是怎么回事?
【问题讨论】: