Skip to content

Commit

Permalink
Fix time crate type name
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Mar 3, 2023
1 parent 7c517a3 commit 4261f85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/sitemap_index_writer.rs
Expand Up @@ -108,11 +108,12 @@ type Result<T, E = Error> = std::result::Result<T, E>;
/// let mut writer = SitemapIndexWriter::start(Cursor::new(Vec::new()))?;
/// writer.write(
/// Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?
/// // `::time::OffsetDateTime` support
/// .lastmod(::time::macros::datetime!(2004-10-01 18:23:17+00:00))?
/// )?;
/// writer.write(
/// Sitemap::loc("http://www.example.com/sitemap2.xml.gz")?
/// // `time::Date` and `time::DateTime` are supported.
/// // `::time::Date` support
/// .lastmod(::time::macros::date!(2005-01-01))?,
/// )?;
/// writer.end()?;
Expand Down
7 changes: 4 additions & 3 deletions tests/sitemap_index_writer.rs
Expand Up @@ -103,12 +103,13 @@ fn test_sitemap_index_writer_write_sitemap_with_time_feature() -> anyhow::Result
let mut writer = SitemapIndexWriter::start(Cursor::new(Vec::new()))?;
writer.write(
Sitemap::loc("http://www.example.com/sitemap1.xml.gz")?
.lastmod("2004-10-01T18:23:17+00:00")?,
// `::time::OffsetDateTime` support
.lastmod(::time::macros::datetime!(2004-10-01 18:23:17 +00:00))?,
)?;
#[rustfmt::skip]
writer.write(
Sitemap::loc("http://www.example.com/sitemap2.xml.gz")?
// `time::Date` and `time::DateTime` are supported.
// `::time::Date` support
.lastmod(::time::macros::date!(2005-01-01))?,
)?;
writer.end()?;
Expand All @@ -119,7 +120,7 @@ fn test_sitemap_index_writer_write_sitemap_with_time_feature() -> anyhow::Result
r#"<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">"#,
r#"<sitemap>"#,
r#"<loc>http://www.example.com/sitemap1.xml.gz</loc>"#,
r#"<lastmod>2004-10-01T18:23:17+00:00</lastmod>"#,
r#"<lastmod>2004-10-01T18:23:17.000000000Z</lastmod>"#,
r#"</sitemap>"#,
r#"<sitemap>"#,
r#"<loc>http://www.example.com/sitemap2.xml.gz</loc>"#,
Expand Down
4 changes: 2 additions & 2 deletions tests/sitemap_writer.rs
Expand Up @@ -185,14 +185,14 @@ fn test_sitemap_writer_write_url_with_time_feature() -> anyhow::Result<()> {
#[rustfmt::skip]
writer.write(
Url::loc("http://www.example.com/catalog?item=73&desc=vacation_new_zealand")?
// `time::Date` support
// `::time::Date` support
.lastmod(::time::macros::date!(2004-12-23))?
.changefreq(Changefreq::Weekly)?
)?;
#[rustfmt::skip]
writer.write(
Url::loc("http://www.example.com/catalog?item=74&desc=vacation_newfoundland")?
// `time::DateTime` support
// `::time::OffsetDateTime` support
.lastmod(::time::macros::datetime!(2004-12-23 18:00:15 +00:00))?
.priority(0.3)?
)?;
Expand Down

0 comments on commit 4261f85

Please sign in to comment.