Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rust 已安装rss板条箱,但找不到函数Channel::from_url_Rust_Rust Cargo - Fatal编程技术网

Rust 已安装rss板条箱,但找不到函数Channel::from_url

Rust 已安装rss板条箱,但找不到函数Channel::from_url,rust,rust-cargo,Rust,Rust Cargo,我试图在一个项目中使用RSS板条箱。我向Cargo.toml中的依赖项添加了rss=“1.5.0”,并构建了我的代码: extern crate regex; extern crate rss; use rss::Channel; fn main() { let channel = Channel::from_url("https://feedpress.me/usererror.xml"); } 运行cargo build时,出现以下错误: $cargo build 编译rss_

我试图在一个项目中使用RSS板条箱。我向Cargo.toml中的依赖项添加了
rss=“1.5.0”
,并构建了我的代码:

extern crate regex;
extern crate rss;

use rss::Channel;

fn main() {
    let channel = Channel::from_url("https://feedpress.me/usererror.xml");
}
运行cargo build时,出现以下错误:

$cargo build
编译rss_f v0.1.0(file:///home/philippe/test/rss_f)
错误[E0599]:在当前作用域中找不到类型为`rss::Channel`的名为`from_url`的函数或关联项
-->src/main.rs:7:19
|
7 | let channel=channel::from_url(“https://feedpress.me/usererror.xml");
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`
当我突出显示VScode中的函数时,我从RLS中得到一个错误,同时Racer给了我函数的定义。因此,板条箱已安装,但货物无法使用。

如果您重新阅读,请强调我的:

从URL 还可以从URL读取频道

注意:这需要启用
from\u url
功能

use rss::Channel;

let channel = Channel::from_url("http://example.com/feed.xml").unwrap();
因此,您需要在您的Cargo.toml中启用该功能:

rss = { version = "1.5.0", features = ["from_url"] }
如果你重新阅读,请强调我的:

从URL 还可以从URL读取频道

注意:这需要启用
from\u url
功能

use rss::Channel;

let channel = Channel::from_url("http://example.com/feed.xml").unwrap();
因此,您需要在您的Cargo.toml中启用该功能:

rss = { version = "1.5.0", features = ["from_url"] }