1use serde::{Deserialize, Serialize};
3
4use crate::svg::options::{PartialRenderOptions, RenderOptions};
5use crate::PathAssembleOptions;
6
7#[derive(Debug, Clone, Deserialize, Serialize)]
11pub struct Skin {
12 pub assemble: Option<PathAssembleOptions>,
14 pub render: Option<PartialRenderOptions>,
16}
17
18
19impl Skin {
20 pub fn options(self) -> (PathAssembleOptions, RenderOptions) {
24 (self.assemble.unwrap_or_default(), self.render.map_or_else(RenderOptions::default, RenderOptions::from))
25 }
26
27 #[cfg(feature = "json5")]
29 #[inline]
30 pub fn from_json5(s: &str) -> Result<Self, json5::Error> {
31 json5::from_str(s)
32 }
33
34 #[cfg(feature = "serde_json")]
36 #[inline]
37 pub fn from_json(s: &str) -> Result<Self, serde_json::error::Error> {
38 serde_json::from_str(s)
39 }
40}