merman_render/svg/icon_registry/
pack.rs1#[derive(Clone, Copy)]
7pub struct IconPack<'a> {
8 json: &'a [u8],
9 registration_name: Option<&'a str>,
10}
11
12impl std::fmt::Debug for IconPack<'_> {
13 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14 formatter
15 .debug_struct("IconPack")
16 .field("json_len", &self.json.len())
17 .field(
18 "registration_name_len",
19 &self.registration_name.map(str::len),
20 )
21 .finish_non_exhaustive()
22 }
23}
24
25impl<'a> IconPack<'a> {
26 pub const fn new(json: &'a [u8]) -> Self {
27 Self {
28 json,
29 registration_name: None,
30 }
31 }
32
33 #[must_use]
34 pub const fn with_registration_name(mut self, registration_name: &'a str) -> Self {
35 self.registration_name = Some(registration_name);
36 self
37 }
38
39 pub const fn json(self) -> &'a [u8] {
40 self.json
41 }
42
43 pub const fn registration_name(self) -> Option<&'a str> {
44 self.registration_name
45 }
46}