no changes, release 1.0

This commit is contained in:
Edgar 2023-02-26 11:18:45 +01:00
parent fd9e34d061
commit 6a06c39df8
2 changed files with 18 additions and 22 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sitewriter" name = "sitewriter"
version = "0.5.5" version = "1.0.0"
authors = ["Edgar <git@edgarluque.com>"] authors = ["Edgar <git@edgarluque.com>"]
edition = "2021" edition = "2021"
description = "A sitemap writing library." description = "A sitemap writing library."

View file

@ -64,18 +64,13 @@
//! let result = sitewriter::generate_str(&urls); //! let result = sitewriter::generate_str(&urls);
//! println!("{}", result); //! println!("{}", result);
//! ``` //! ```
//!
//! ## CREV - Rust code reviews - Raise awareness #![forbid(unsafe_code)]
//! #![deny(missing_docs)]
//! Please, spread this info !\ #![deny(warnings)]
//! Open source code needs a community effort to express trustworthiness.\ #![deny(clippy::nursery)]
//! Start with reading the reviews of the crates you use on [web.crev.dev/rust-reviews/crates/](https://web.crev.dev/rust-reviews/crates/) \ #![deny(clippy::pedantic)]
//! Than install the CLI [cargo-crev](https://github.com/crev-dev/cargo-crev)\. Follow the [Getting Started guide](https://github.com/crev-dev/cargo-crev/blob/master/cargo-crev/src/doc/getting_started.md). \ #![deny(clippy::all)]
//! On your Rust project, verify the trustworthiness of all dependencies, including transient dependencies with `cargo crev verify`\
//! Write a new review ! \
//! Describe the crates you trust. Or warn about the crate versions you think are dangerous.\
//! Help other developers, inform them and share your opinion.\
//! Use [cargo_crev_reviews](https://crates.io/crates/cargo_crev_reviews) to write reviews easily.
use chrono::{DateTime, SecondsFormat, Utc}; use chrono::{DateTime, SecondsFormat, Utc};
use derive_builder::Builder; use derive_builder::Builder;
@ -111,13 +106,13 @@ pub enum ChangeFreq {
impl Display for ChangeFreq { impl Display for ChangeFreq {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let what = match self { let what = match self {
ChangeFreq::Always => "always", Self::Always => "always",
ChangeFreq::Hourly => "hourly", Self::Hourly => "hourly",
ChangeFreq::Daily => "daily", Self::Daily => "daily",
ChangeFreq::Weekly => "weekly", Self::Weekly => "weekly",
ChangeFreq::Monthly => "monthly", Self::Monthly => "monthly",
ChangeFreq::Yearly => "yearly", Self::Yearly => "yearly",
ChangeFreq::Never => "never", Self::Never => "never",
}; };
f.write_str(what) f.write_str(what)
} }
@ -145,6 +140,7 @@ pub struct UrlEntry {
} }
impl UrlEntry { impl UrlEntry {
/// Create a new url entry.
#[must_use] #[must_use]
pub const fn new( pub const fn new(
loc: Url, loc: Url,
@ -207,7 +203,7 @@ where
)?; )?;
} }
if let Some(priority) = &entry.priority { if let Some(priority) = &entry.priority {
write_tag(&mut writer, "priority", &format!("{:.1}", priority))?; write_tag(&mut writer, "priority", &format!("{priority:.1}"))?;
} }
if let Some(changefreq) = &entry.changefreq { if let Some(changefreq) = &entry.changefreq {
write_tag(&mut writer, "changefreq", &changefreq.to_string())?; write_tag(&mut writer, "changefreq", &changefreq.to_string())?;
@ -241,7 +237,7 @@ pub fn generate_str(urls: &[UrlEntry]) -> String {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::*; use crate::{generate_str, ChangeFreq, UrlEntry, UrlEntryBuilder};
#[test] #[test]
fn it_works() { fn it_works() {