https://github.com/avitex/rust-badgen
Rust implementation of badge generation
https://github.com/avitex/rust-badgen
badge-generator no-std rust-lang
Last synced: about 2 months ago
JSON representation
Rust implementation of badge generation
- Host: GitHub
- URL: https://github.com/avitex/rust-badgen
- Owner: avitex
- License: mit
- Created: 2020-04-19T16:25:32.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T19:02:56.000Z (over 2 years ago)
- Last Synced: 2025-03-26T13:11:19.380Z (3 months ago)
- Topics: badge-generator, no-std, rust-lang
- Language: Rust
- Size: 373 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/avitex/rust-badgen/actions?query=workflow:build)
[](https://codecov.io/gh/avitex/rust-badgen)
[](https://crates.io/crates/badgen)
[](https://docs.rs/badgen)
# rust-badgen
**Rust SVG badge generator with font path rendering.**
Documentation hosted on [docs.rs](https://docs.rs/badgen).```toml
[dependencies]
badgen = "0.1"
```## Examples
**Classic**

```rust
let badge = badgen::badge(&badgen::Style::classic(), "4.2 KB", Some("minzipped size")).unwrap();
println!("{}", badge);
```**Flat**

```rust
let badge = badgen::badge(&badgen::Style::flat(), "4.2 KB", Some("minzipped size")).unwrap();
println!("{}", badge);
```## Benchmarks
Benchmarks were run on an AMD Ryzen 9 3950X on the 17th of Jun 20.
```text
classic time: [1.8844 us 1.8888 us 1.8933 us]
Found 4 outliers among 100 measurements (4.00%)
2 (2.00%) low mild
2 (2.00%) high mildflat time: [1.3516 us 1.3536 us 1.3556 us]
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) low mild
1 (1.00%) high milddefault-slow time: [11.833 us 11.847 us 11.863 us]
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) low mild
```## Credits
Initially inspired by [github.com/badgen/badgen](https://github.com/badgen/badgen),
but I decided to generate badges in a different manner.