init
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
use std::error::Error;
|
||||
|
||||
use rss::Channel;
|
||||
|
||||
async fn example_feed() -> Result<Channel, Box<dyn Error>> {
|
||||
let content = reqwest::get("https://www.heise.de/rss/heise.rdf")
|
||||
.await?
|
||||
.bytes()
|
||||
.await?;
|
||||
println!("{}", String::from("reading done"));
|
||||
let channel = Channel::read_from(&content[..])?;
|
||||
Ok(channel)
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let channel: Channel = example_feed().await?;
|
||||
|
||||
println!("{:?}", channel);
|
||||
for item in channel.items {
|
||||
println!("{}", item.content.unwrap());
|
||||
}
|
||||
println!("{}", String::from("test"));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user