Compare commits
5 Commits
7b010a655b
...
e5312509b9
Author | SHA1 | Date |
---|---|---|
Bauke | e5312509b9 | |
Bauke | 581a79fe6b | |
Bauke | 3719548607 | |
Bauke | f635062299 | |
Bauke | b07efbf43f |
|
@ -4,7 +4,7 @@
|
||||||
name = "gravatar-rs"
|
name = "gravatar-rs"
|
||||||
description = "Gravatar image URL library"
|
description = "Gravatar image URL library"
|
||||||
authors = ["Holllo <helllo@holllo.cc>"]
|
authors = ["Holllo <helllo@holllo.cc>"]
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/Holllo/gravatar-rs"
|
repository = "https://github.com/Holllo/gravatar-rs"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
|
@ -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"
|
||||||
|
]
|
|
@ -24,9 +24,12 @@
|
||||||
//! "https://www.gravatar.com/avatar/ebff9105dce4954b1bdb57fdab079ff3"
|
//! "https://www.gravatar.com/avatar/ebff9105dce4954b1bdb57fdab079ff3"
|
||||||
//! );
|
//! );
|
||||||
//! ```
|
//! ```
|
||||||
|
//!
|
||||||
|
//! For all possible options see [`Generator`].
|
||||||
|
|
||||||
/// A generator for Gravatar image URLs.
|
/// A generator for Gravatar image URLs.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct Generator {
|
pub struct Generator {
|
||||||
/// The base URL for images, defaults to `www.gravatar.com`.
|
/// The base URL for images, defaults to `www.gravatar.com`.
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
|
@ -111,6 +114,7 @@ impl Generator {
|
||||||
|
|
||||||
/// Returns all configurable options as a query parameter string.
|
/// Returns all configurable options as a query parameter string.
|
||||||
pub fn query_parameters(&self) -> String {
|
pub fn query_parameters(&self) -> String {
|
||||||
|
/// Shorthand for [`urlencoding::encode`].
|
||||||
fn encode<D: std::fmt::Display>(data: D) -> String {
|
fn encode<D: std::fmt::Display>(data: D) -> String {
|
||||||
urlencoding::encode(&data.to_string()).into_owned()
|
urlencoding::encode(&data.to_string()).into_owned()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue