1
Fork 0

Compare commits

...

5 Commits

Author SHA1 Message Date
Bauke e5312509b9
Add documentation. 2022-09-26 11:55:35 +02:00
Bauke 581a79fe6b
Add cargo-make file. 2022-09-26 11:50:47 +02:00
Bauke 3719548607
Version 0.2.0. 2022-04-02 22:18:57 +02:00
Bauke f635062299
Make Generator non_exhaustive. 2022-04-02 22:18:27 +02:00
Bauke b07efbf43f
Add note for the rest of the options. 2022-04-02 22:17:20 +02:00
3 changed files with 44 additions and 1 deletions

View File

@ -4,7 +4,7 @@
name = "gravatar-rs"
description = "Gravatar image URL library"
authors = ["Holllo <helllo@holllo.cc>"]
version = "0.1.0"
version = "0.2.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Holllo/gravatar-rs"
edition = "2021"

39
Makefile.toml Normal file
View File

@ -0,0 +1,39 @@
[tasks.fmt]
command = "cargo"
args = ["fmt", "${@}"]
[tasks.check]
command = "cargo"
args = ["check", "${@}"]
[tasks.clippy]
command = "cargo"
args = ["clippy", "${@}"]
[tasks.test]
command = "cargo"
args = ["test", "${@}"]
[tasks.doc]
command = "cargo"
args = ["doc", "${@}"]
[tasks.build]
command = "cargo"
args = ["build", "${@}"]
[tasks.complete-check]
dependencies = ["fmt", "check", "clippy", "test", "doc", "build"]
[tasks.code-coverage]
workspace = false
install_crate = "cargo-tarpaulin"
command = "cargo"
args = [
"tarpaulin",
"--exclude-files=target/*",
"--out=html",
"--output-dir=coverage",
"--skip-clean",
"--target-dir=target/tarpaulin"
]

View File

@ -24,9 +24,12 @@
//! "https://www.gravatar.com/avatar/ebff9105dce4954b1bdb57fdab079ff3"
//! );
//! ```
//!
//! For all possible options see [`Generator`].
/// A generator for Gravatar image URLs.
#[derive(Debug)]
#[non_exhaustive]
pub struct Generator {
/// The base URL for images, defaults to `www.gravatar.com`.
pub base_url: String,
@ -111,6 +114,7 @@ impl Generator {
/// Returns all configurable options as a query parameter string.
pub fn query_parameters(&self) -> String {
/// Shorthand for [`urlencoding::encode`].
fn encode<D: std::fmt::Display>(data: D) -> String {
urlencoding::encode(&data.to_string()).into_owned()
}