diff --git a/README.md b/README.md index 1366072..6464a9c 100644 --- a/README.md +++ b/README.md @@ -17,54 +17,54 @@ It uses the [quick-xml](https://github.com/tafia/quick-xml) so it should be fast use chrono::prelude::*; use sitewriter::{ChangeFreq, UrlEntry, UrlEntryBuilder}; - let urls = vec![ - UrlEntryBuilder::default() - .loc("https://edgarluque.com/projects".parse().unwrap()) - .build() - .unwrap(), - UrlEntry { - loc: "https://edgarluque.com/".parse().unwrap(), - changefreq: Some(ChangeFreq::Daily), - priority: Some(1.0), - lastmod: Some(Utc::now()), - }, - UrlEntry { - loc: "https://edgarluque.com/blog".parse().unwrap(), - changefreq: Some(ChangeFreq::Weekly), - priority: Some(0.8), - lastmod: Some(Utc::now()), - }, - UrlEntry { - loc: "https://edgarluque.com/blog/sitewriter".parse().unwrap(), - changefreq: Some(ChangeFreq::Never), - priority: Some(0.5), - lastmod: Some(Utc.ymd(2020, 11, 22).and_hms(15, 10, 15)), - }, - UrlEntry { - loc: "https://edgarluque.com/blog/some-future-post" - .parse() - .unwrap(), - changefreq: Some(ChangeFreq::Never), - priority: Some(0.5), - lastmod: Some( - Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), - ), - }, - // Entity escaping - UrlEntry { - loc: "https://edgarluque.com/blog/test&id=''" - .parse() - .unwrap(), - changefreq: Some(ChangeFreq::Never), - priority: Some(0.5), - lastmod: Some( - Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), - ), - }, - ]; +let urls = vec![ + UrlEntryBuilder::default() + .loc("https://edgarluque.com/projects".parse().unwrap()) + .build() + .unwrap(), + UrlEntry { + loc: "https://edgarluque.com/".parse().unwrap(), + changefreq: Some(ChangeFreq::Daily), + priority: Some(1.0), + lastmod: Some(Utc::now()), + }, + UrlEntry { + loc: "https://edgarluque.com/blog".parse().unwrap(), + changefreq: Some(ChangeFreq::Weekly), + priority: Some(0.8), + lastmod: Some(Utc::now()), + }, + UrlEntry { + loc: "https://edgarluque.com/blog/sitewriter".parse().unwrap(), + changefreq: Some(ChangeFreq::Never), + priority: Some(0.5), + lastmod: Some(Utc.ymd(2020, 11, 22).and_hms(15, 10, 15)), + }, + UrlEntry { + loc: "https://edgarluque.com/blog/some-future-post" + .parse() + .unwrap(), + changefreq: Some(ChangeFreq::Never), + priority: Some(0.5), + lastmod: Some( + Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), + ), + }, + // Entity escaping + UrlEntry { + loc: "https://edgarluque.com/blog/test&id=''" + .parse() + .unwrap(), + changefreq: Some(ChangeFreq::Never), + priority: Some(0.5), + lastmod: Some( + Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), + ), + }, +]; - let result = sitewriter::generate_str(&urls); - println!("{}", result); +let result = sitewriter::generate_str(&urls); +println!("{}", result); ``` ### CREV - Rust code reviews - Raise awareness diff --git a/src/lib.rs b/src/lib.rs index aad9774..0033172 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,54 +15,54 @@ //! use chrono::prelude::*; //! use sitewriter::{ChangeFreq, UrlEntry, UrlEntryBuilder}; //! -//! let urls = vec![ -//! UrlEntryBuilder::default() -//! .loc("https://edgarluque.com/projects".parse().unwrap()) -//! .build() -//! .unwrap(), -//! UrlEntry { -//! loc: "https://edgarluque.com/".parse().unwrap(), -//! changefreq: Some(ChangeFreq::Daily), -//! priority: Some(1.0), -//! lastmod: Some(Utc::now()), -//! }, -//! UrlEntry { -//! loc: "https://edgarluque.com/blog".parse().unwrap(), -//! changefreq: Some(ChangeFreq::Weekly), -//! priority: Some(0.8), -//! lastmod: Some(Utc::now()), -//! }, -//! UrlEntry { -//! loc: "https://edgarluque.com/blog/sitewriter".parse().unwrap(), -//! changefreq: Some(ChangeFreq::Never), -//! priority: Some(0.5), -//! lastmod: Some(Utc.ymd(2020, 11, 22).and_hms(15, 10, 15)), -//! }, -//! UrlEntry { -//! loc: "https://edgarluque.com/blog/some-future-post" -//! .parse() -//! .unwrap(), -//! changefreq: Some(ChangeFreq::Never), -//! priority: Some(0.5), -//! lastmod: Some( -//! Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), -//! ), -//! }, -//! // Entity escaping -//! UrlEntry { -//! loc: "https://edgarluque.com/blog/test&id=''" -//! .parse() -//! .unwrap(), -//! changefreq: Some(ChangeFreq::Never), -//! priority: Some(0.5), -//! lastmod: Some( -//! Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), -//! ), -//! }, -//! ]; +//! let urls = vec![ +//! UrlEntryBuilder::default() +//! .loc("https://edgarluque.com/projects".parse().unwrap()) +//! .build() +//! .unwrap(), +//! UrlEntry { +//! loc: "https://edgarluque.com/".parse().unwrap(), +//! changefreq: Some(ChangeFreq::Daily), +//! priority: Some(1.0), +//! lastmod: Some(Utc::now()), +//! }, +//! UrlEntry { +//! loc: "https://edgarluque.com/blog".parse().unwrap(), +//! changefreq: Some(ChangeFreq::Weekly), +//! priority: Some(0.8), +//! lastmod: Some(Utc::now()), +//! }, +//! UrlEntry { +//! loc: "https://edgarluque.com/blog/sitewriter".parse().unwrap(), +//! changefreq: Some(ChangeFreq::Never), +//! priority: Some(0.5), +//! lastmod: Some(Utc.ymd(2020, 11, 22).and_hms(15, 10, 15)), +//! }, +//! UrlEntry { +//! loc: "https://edgarluque.com/blog/some-future-post" +//! .parse() +//! .unwrap(), +//! changefreq: Some(ChangeFreq::Never), +//! priority: Some(0.5), +//! lastmod: Some( +//! Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), +//! ), +//! }, +//! // Entity escaping +//! UrlEntry { +//! loc: "https://edgarluque.com/blog/test&id=''" +//! .parse() +//! .unwrap(), +//! changefreq: Some(ChangeFreq::Never), +//! priority: Some(0.5), +//! lastmod: Some( +//! Utc.from_utc_datetime(&Local.ymd(2020, 12, 5).and_hms(12, 30, 0).naive_utc()), +//! ), +//! }, +//! ]; //! -//! let result = sitewriter::generate_str(&urls); -//! println!("{}", result); +//! let result = sitewriter::generate_str(&urls); +//! println!("{}", result); //! ``` //! //! ## CREV - Rust code reviews - Raise awareness