diff --git a/opml_api/examples/opml_samples/rust_feeds.opml b/opml_api/examples/opml_samples/rust_feeds.opml
deleted file mode 100644
index 4c5d221..0000000
--- a/opml_api/examples/opml_samples/rust_feeds.opml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- Rust Feeds
-
-
-
-
-
-
diff --git a/opml_api/examples/rss.rs b/opml_api/examples/rss.rs
index 9b88cbc..a6dff5c 100644
--- a/opml_api/examples/rss.rs
+++ b/opml_api/examples/rss.rs
@@ -1,26 +1,31 @@
-use std::{error::Error, fs};
-
use opml::OPML;
-fn main() -> Result<(), Box> {
- let xml = fs::read_to_string("examples/opml_samples/rust_feeds.opml")?;
+const SAMPLE: &str = r#"
+
+ Rust Feeds
+
+
+
+
+
+"#;
- let subscriptions = OPML::from_str(&xml)?;
- let head = subscriptions.head.unwrap();
- let title = head.title.unwrap();
+/// Run this example using `cargo run --example rss`.
+///
+/// Output:
+/// Rust Feeds
+/// ──────────
+/// Rust Blog https://blog.rust-lang.org/feed.xml
+/// Inside Rust https://blog.rust-lang.org/inside-rust/feed.xml
+fn main() {
+ let subscriptions = OPML::from_str(SAMPLE).unwrap();
- println!(" {}", title);
- println!(" {}", "─".repeat(title.len()));
-
- for outline in subscriptions.body.outlines {
- println!(" {}\t{}", outline.text, outline.xml_url.unwrap());
+ if let Some(title) = subscriptions.head.and_then(|head| head.title) {
+ println!("{}", title);
+ println!("{}", "-".repeat(title.len()));
}
- Ok(())
+ for outline in subscriptions.body.outlines {
+ println!("{}\t{}", outline.text, outline.xml_url.unwrap());
+ }
}
-
-// Output:
-// Rust Feeds
-// ──────────
-// Rust Blog https://blog.rust-lang.org/feed.xml
-// Inside Rust https://blog.rust-lang.org/inside-rust/feed.xml