Rust 的 RSS 开发包 rust-rss

码农软件 · 软件分类 · RSS/ATOM相关 · 2019-04-12 09:27:15

软件介绍

rust-rss 是 Rust 语言用来解析和生成 RSS 数据的开发包,示例代码:

生成:

use rss::{Channel, Item, Rss};

let item = Item {
    title: Some(String::from("Ford hires Elon Musk as CEO")),
    pub_date: Some(String::from("01 Apr 2019 07:30:00 GMT")),
    description: Some(String::from("In an unprecedented move, Ford hires Elon Musk.")),
    ..Default::default()
};

let channel = Channel {
    title: String::from("TechCrunch"),
    link: String::from("http://techcrunch.com"),
    description: String::from("The latest technology news and information on startups"),
    items: vec![item],
    ..Default::default()
};

let rss = Rss(channel);

let rss_string = rss.to_string();

解析:

use rss::Rss;

let rss_str = r#"
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>TechCrunch</title>
    <link>http://techcrunch.com</link>
    <description>The latest technology news and information on startups</description>
    <item>
      <title>Ford hires Elon Musk as CEO</title>
      <pubDate>01 Apr 2019 07:30:00 GMT</pubDate>
      <description>In an unprecedented move, Ford hires Elon Musk.</description>
    </item>
  </channel>
</rss>
"#;

let rss = rss_str.parse::<Rss>().unwrap();

本文地址:https://codercto.com/soft/d/3402.html

Data Structures and Algorithms in Python

Data Structures and Algorithms in Python

Michael T. Goodrich、Roberto Tamassia、Michael H. Goldwasser / John Wiley & Sons / 2013-7-5 / GBP 121.23

Based on the authors' market leading data structures books in Java and C++, this book offers a comprehensive, definitive introduction to data structures in Python by authoritative authors. Data Struct......一起来看看 《Data Structures and Algorithms in Python》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具