Skip to main content

nik_rev/
lib.rs

1#[macro_export]
2macro_rules! badges {
3    (repo = $repo_name:literal) => {
4        $crate::badges!(repo = $repo_name, msrv = env!("CARGO_PKG_RUST_VERSION"))
5    };
6    (repo = $repo_name:literal, msrv = $rust_version:expr) => {
7        concat!(
8            "[![crates.io](https://img.shields.io/crates/v/", env!("CARGO_PKG_NAME"), "?style=flat-square&logo=rust)](https://crates.io/crates/", env!("CARGO_PKG_NAME"), ")\n",
9            "[![docs.rs](https://img.shields.io/badge/docs.rs-", env!("CARGO_PKG_NAME"), "-blue?style=flat-square&logo=docs.rs)](https://docs.rs/", env!("CARGO_PKG_NAME"), ")\n",
10            "![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)\n",
11            "![msrv](https://img.shields.io/badge/msrv-", $rust_version, "-blue?style=flat-square&logo=rust)\n",
12            "[![github](https://img.shields.io/github/stars/nik-rev/", $repo_name, ")](https://github.com/nik-rev/", $repo_name, ")"
13        )
14    };
15}
16
17#[macro_export]
18#[rustfmt::skip]
19macro_rules! add_dependency {
20    () => {
21        concat!(
22            "```toml\n",
23            env!("CARGO_CRATE_NAME"), " = \"",  env!("CARGO_PKG_VERSION_MAJOR"), ".", env!("CARGO_PKG_VERSION_MINOR"), "\"\n",
24            "```\n",
25        )
26    };
27}