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
use serde::{Deserialize, Serialize};
use crate::theme::ThemeWarnings;
pub use self::{graphviz_image::GraphvizImage, graphviz_opts::GraphvizOpts};
mod graphviz_image;
mod graphviz_opts;
/// Graphviz dot source and CSS styles.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct DotSrcAndStyles {
/// Graphviz dot source to run in `dot`.
pub dot_src: String,
/// Tailwind CSS styles to put into `<styles>..</styles>`.
pub styles: String,
/// Options to pass to graphviz when rendering.
pub opts: GraphvizOpts,
/// Warnings detected while computing CSS utility classes.
pub theme_warnings: ThemeWarnings,
}
impl DotSrcAndStyles {
/// Returns a new `DotSrcAndStyles` object.
pub fn new(
dot_src: String,
styles: String,
opts: GraphvizOpts,
theme_warnings: ThemeWarnings,
) -> Self {
Self {
dot_src,
styles,
opts,
theme_warnings,
}
}
/// Returns the Graphviz dot source to run in `dot`.
pub fn dot_src(&self) -> &str {
&self.dot_src
}
/// Returns the tailwind CSS styles to put into `<styles>..</styles>`.
pub fn styles(&self) -> &str {
&self.styles
}
/// Returns the options to pass to graphviz when rendering.
pub fn opts(&self) -> &GraphvizOpts {
&self.opts
}
/// Returns the warnings detected while computing CSS utility classes.
pub fn theme_warnings(&self) -> &ThemeWarnings {
&self.theme_warnings
}
}