【发布时间】:2018-07-17 06:37:32
【问题描述】:
我正在使用重新导出板条箱“mime”的 Hyper 0.11。我正在尝试从字符串创建 MIME 类型:
extern crate hyper;
fn main() {
let test1 = hyper::mime::Mime::from_str("text/html+xml").unwrap();
}
错误:
error[E0599]: no function or associated item named `from_str` found for type `hyper::<unnamed>::Mime` in the current scope
为什么会出现这个错误,是什么原因?如何解决?
【问题讨论】:
-
新错误,新问题。是什么让您认为
Header是为Mime实现的?此处未列出:docs.rs/hyper/0.11.17/hyper/header/trait.Header.html - 也许您想要ContentType标头,它有一个Mime字段。
标签: rust