1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*!
A simple badge generator in shields.io style, for Rust.
### Features
- Simple, bare-minimum API.
- Plastic, Flat, and Flat-Squared styles
- SVG output
### Example
```rust
use std::fs;
use std::io;
use ab_glyph::FontArc;
use shield_maker::{Renderer, Metadata, Style, FontFamily};
fn main() -> io::Result<()> {
let font_bytes = fs::read("tests/resources/DejaVuSans.ttf")
.expect("could not read DejaVuSans.ttf");
let font = FontArc::try_from_vec(font_bytes)
.expect("could not parse DejaVuSans.ttf");
let meta = &Metadata {
style: Style::Plastic,
label: "coverage",
message: "100%",
font,
font_family: FontFamily::Default,
label_color: None,
color: None,
};
let output = Renderer::render(meta);
let raw_plastic_badge = fs::read("tests/resources/plastic_badge.svg")
.expect("could not read plastic_badge.svg");
let plastic_badge: String = String::from_utf8(raw_plastic_badge)
.expect("failed converting plastic_badge.svg to String")
.trim()
.into();
assert_eq!(plastic_badge, output);
Ok(())
}
```
*/
pub use ;