Crates.io | atom_syndication |
lib.rs | atom_syndication |
version | |
source | src |
created_at | 2015-05-18 01:51:27.360652 |
updated_at | 2024-12-20 18:08:04.682225 |
description | Library for serializing the Atom web content syndication format |
homepage | |
repository | https://github.com/rust-syndication/atom |
max_upload_size | |
id | 2136 |
Cargo.toml error: | TOML parse error at line 25, column 1 | 25 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Library for serializing the Atom web content syndication format.
This crate requires Rustc version 1.57.0 or greater.
Add the dependency to your Cargo.toml
.
[dependencies]
atom_syndication = "0.12"
Or, if you want Serde include the feature like this:
[dependencies]
atom_syndication = { version = "0.12", features = ["with-serde"] }
The package includes a single crate named atom_syndication
.
extern crate atom_syndication;
A feed can be read from any object that implements the BufRead
trait or using the FromStr
trait.
use std::fs::File;
use std::io::BufReader;
use atom_syndication::Feed;
let file = File::open("example.xml").unwrap();
let feed = Feed::read_from(BufReader::new(file)).unwrap();
let string = "<feed></feed>";
let feed = string.parse::<Feed>().unwrap();
A feed can be written to any object that implements the Write
trait or converted to an XML string using the ToString
trait.
use std::fs::File;
use std::io::{BufReader, sink};
use atom_syndication::Feed;
let file = File::open("example.xml").unwrap();
let feed = Feed::read_from(BufReader::new(file)).unwrap();
// write to the feed to a writer
feed.write_to(sink()).unwrap();
// convert the feed to a string
let string = feed.to_string();
As a best effort to parse invalid feeds atom_syndication
will default elements declared as "required" by the Atom specification to an empty string.
Licensed under either of
at your option.