rss crate 已安装,但找不到函数 Channel::from_url
rss crate is installed, but cannot find the function Channel::from_url
我尝试在一个项目中使用 RSS crate。我将 rss = "1.5.0"
添加到 Cargo.toml 中的依赖项并构建了我的代码:
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
Compiling rss_f v0.1.0 (file:///home/philippe/test/rss_f)
error[E0599]: no function or associated item named `from_url` found for type `rss::Channel` in the current scope
--> src/main.rs:7:19
|
7 | let channel = Channel::from_url("https://feedpress.me/usererror.xml");
| ^^^^^^^^^^^^^^^^^ function or associated item not found in `rss::Channel`
当我突出显示 VScode 中的函数时,RLS 出现错误,同时 Racer 给出了函数的定义。所以箱子已经安装了,但是 Cargo 不能使用它。
如果你重读 the documentation,强调我的:
From a URL
A channel can also be read from a URL.
Note: This requires enabling the from_url
feature.
use rss::Channel;
let channel = Channel::from_url("http://example.com/feed.xml").unwrap();
因此,您需要在 Cargo.toml:
中启用该功能
rss = { version = "1.5.0", features = ["from_url"] }
我尝试在一个项目中使用 RSS crate。我将 rss = "1.5.0"
添加到 Cargo.toml 中的依赖项并构建了我的代码:
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
Compiling rss_f v0.1.0 (file:///home/philippe/test/rss_f)
error[E0599]: no function or associated item named `from_url` found for type `rss::Channel` in the current scope
--> src/main.rs:7:19
|
7 | let channel = Channel::from_url("https://feedpress.me/usererror.xml");
| ^^^^^^^^^^^^^^^^^ function or associated item not found in `rss::Channel`
当我突出显示 VScode 中的函数时,RLS 出现错误,同时 Racer 给出了函数的定义。所以箱子已经安装了,但是 Cargo 不能使用它。
如果你重读 the documentation,强调我的:
From a URL
A channel can also be read from a URL.
Note: This requires enabling the
from_url
feature.use rss::Channel; let channel = Channel::from_url("http://example.com/feed.xml").unwrap();
因此,您需要在 Cargo.toml:
中启用该功能rss = { version = "1.5.0", features = ["from_url"] }