upgrade deps, version 0.4.1

This commit is contained in:
Edgar 2021-10-19 17:11:10 +02:00
parent 91a1ead43c
commit 5d93e6a617
No known key found for this signature in database
GPG key ID: 8731E6C0166EAA85
3 changed files with 75 additions and 62 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "sitewriter"
version = "0.4.0"
version = "0.4.1"
authors = ["Edgar <git@edgarluque.com>"]
edition = "2018"
description = "A sitemap writing library."
@ -13,13 +13,19 @@ categories = ["parsing"]
[dependencies]
chrono = "0.4.19"
derive_builder = "0.10.0"
derive_builder = "0.10.2"
quick-xml = "0.22.0"
url = "2.2.1"
url = "2.2.2"
[dev-dependencies]
criterion = { version = "0.3.4", features = ["html_reports"] }
criterion = { version = "0.3.5", features = ["html_reports"] }
[[bench]]
name = "benchmark"
harness = false
[profile.bench]
debug = true
[profile.release]
debug = true

117
README.md
View file

@ -1,68 +1,69 @@
# Sitewriter
[![Rust](https://github.com/edg-l/sitewriter/workflows/Rust/badge.svg)](https://github.com/edg-l/sitewriter/actions)
[![crates.io](http://meritbadge.herokuapp.com/sitewriter)](https://crates.io/crates/sitewriter)
[![License](https://img.shields.io/github/license/edg-l/sitewriter)](https://github.com/edg-l/sitewriter/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/edg-l/sitewriter/branch/master/graph/badge.svg?token=JKOQCRSCZU)](https://codecov.io/gh/edg-l/sitewriter)
# sitewriter
A rust library to generate sitemaps.
### A library to generate sitemaps.
[![Version](https://img.shields.io/crates/v/sitewriter)](https://crates.io/crates/sitewriter)
[![Downloads](https://img.shields.io/crates/d/sitewriter)](https://crates.io/crates/sitewriter)
[![License](https://img.shields.io/crates/l/sitewriter)](https://crates.io/crates/sitewriter)
![Rust](https://github.com/edg-l/sitewriter-rs/workflows/Rust/badge.svg)
[![Docs](https://docs.rs/sitewriter/badge.svg)](https://docs.rs/sitewriter)
It uses the [quick-xml](https://github.com/tafia/quick-xml) so it should be fast.
## Example
To run the examples use `cargo run --example gen_sitemap`
### Example
```rust
use chrono::prelude::*;
use sitewriter::*;
use chrono::prelude::*;
use sitewriter::*;
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='<test>'"
.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='<test>'"
.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 = Sitemap::into_str(&urls).unwrap();
println!("{}", result);
let result = Sitemap::generate_str(&urls).unwrap();
println!("{}", result);
```
License: MIT

View file

@ -1,5 +1,11 @@
//! ## A library to generate sitemaps.
//!
//! [![Version](https://img.shields.io/crates/v/sitewriter)](https://crates.io/crates/sitewriter)
//! [![Downloads](https://img.shields.io/crates/d/sitewriter)](https://crates.io/crates/sitewriter)
//! [![License](https://img.shields.io/crates/l/sitewriter)](https://crates.io/crates/sitewriter)
//! ![Rust](https://github.com/edg-l/sitewriter-rs/workflows/Rust/badge.svg)
//! [![Docs](https://docs.rs/sitewriter/badge.svg)](https://docs.rs/sitewriter)
//!
//! It uses the [quick-xml](https://github.com/tafia/quick-xml) so it should be fast.
//!
//! ## Example