1 unstable release
Uses new Rust 2024
new 0.1.0 | May 16, 2025 |
---|
#1531 in Web programming
255KB
559 lines
shields
A high-performance badge rendering engine written in Rust, supporting SVG output and font parsing. This project is designed for developers and services that require fast, customizable, and reliable badge generation, similar to shields.io, but with a focus on performance and extensibility.
Features
- โก High Performance: Built with Rust for maximum speed and efficiency.
- ๐ผ๏ธ SVG Output: Generates crisp, standards-compliant SVG badges.
- ๐ค Font Parsing: Supports custom font rendering using TTF parsing.
- ๐ง LRU Caching: Efficient in-memory caching for repeated badge requests.
- ๐ ๏ธ Extensible API: Easy to integrate and extend for various use cases.
- ๐งช Comprehensive Testing: Includes tests for rendering accuracy and performance.
Installation
Prerequisites
- Rust (edition 2024 or later)
- Cargo package manager (comes with Rust)
Build
Clone the repository and build the project:
git clone https://github.com/Jannchie/shields.git
cd shields
cargo build --release
Run
To run the badge rendering engine:
cargo run --release
Usage Example
Here is a basic example of how to use the shields library in your Rust project:
use shields::BadgeRenderer;
fn main() {
let renderer = BadgeRenderer::new();
let svg = renderer.render("build", "passing", "#4c1");
std::fs::write("badge.svg", svg).unwrap();
}
This will generate a badge.svg
file with a "build: passing" badge.
Contributing
Contributions are welcome! To get started:
- Fork the repository on GitHub.
- Create a new branch for your feature or bugfix.
- Commit your changes with clear messages.
- Open a pull request describing your changes.
- For issues, please use the GitHub Issues page.
Before submitting a PR, ensure all tests pass:
cargo test
License
This project is licensed under the MIT License. See the LICENSE file for details.
Community & Contact
- GitHub: https://github.com/Jannchie/shields
- Documentation: https://docs.rs/shields
- Author: Jannchie (jannchie@gmail.com)
Dependencies
~2.2โ3.5MB
~65K SLoC