1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#![warn(missing_docs, rust_2018_idioms)]
#![doc(html_root_url = "https://docs.rs/atom_syndication/")]

//! Library for serializing the Atom web content syndication format.
//!
//! # Reading
//!
//! A feed can be read from any object that implements the `BufRead` trait or using
//! the `FromStr` trait.
//!
//! ```no_run
//! 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();
//! ```
//!
//! # Writing
//!
//! A feed can be written to any object that implements the `Write` trait or converted to an XML
//! string using the `ToString` trait.
//!
//! **Note**: Writing a feed does not perform any escaping of XML entities.
//!
//! ## Example
//!
//! ```no_run
//! 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();
//! ```

#[cfg(feature = "serde")]
#[macro_use]
extern crate serde;

#[cfg(feature = "builders")]
#[macro_use]
extern crate derive_builder;

mod category;
mod content;
mod entry;
mod feed;
mod generator;
mod link;
mod person;
mod source;

mod error;
mod fromxml;
mod toxml;
mod util;

/// Types and functions for namespaced extensions.
pub mod extension;

pub use crate::category::Category;
#[cfg(feature = "builders")]
pub use crate::category::CategoryBuilder;
pub use crate::content::Content;
#[cfg(feature = "builders")]
pub use crate::content::ContentBuilder;
pub use crate::entry::Entry;
#[cfg(feature = "builders")]
pub use crate::entry::EntryBuilder;
pub use crate::error::Error;
pub use crate::feed::Feed;
#[cfg(feature = "builders")]
pub use crate::feed::FeedBuilder;
pub use crate::generator::Generator;
#[cfg(feature = "builders")]
pub use crate::generator::GeneratorBuilder;
pub use crate::link::Link;
#[cfg(feature = "builders")]
pub use crate::link::LinkBuilder;
pub use crate::person::Person;
#[cfg(feature = "builders")]
pub use crate::person::PersonBuilder;
pub use crate::source::Source;
#[cfg(feature = "builders")]
pub use crate::source::SourceBuilder;
pub use crate::util::FixedDateTime;