charming_fork_zephyr/series/
mod.rs

1use serde::Serialize;
2
3pub mod bar;
4pub mod bar3d;
5pub mod boxplot;
6pub mod candlestick;
7pub mod custom;
8pub mod effect_scatter;
9pub mod funnel;
10pub mod gauge;
11pub mod graph;
12pub mod heatmap;
13pub mod line;
14pub mod lines;
15pub mod map;
16pub mod parallel;
17pub mod pictorial_bar;
18pub mod pie;
19pub mod radar;
20pub mod sankey;
21pub mod scatter;
22pub mod sunburst;
23pub mod theme_river;
24pub mod tree;
25pub mod treemap;
26
27pub use bar::*;
28pub use bar3d::*;
29pub use boxplot::*;
30pub use candlestick::*;
31pub use custom::*;
32pub use effect_scatter::*;
33pub use funnel::*;
34pub use gauge::*;
35pub use graph::*;
36pub use heatmap::*;
37pub use line::*;
38pub use lines::*;
39pub use map::*;
40pub use parallel::*;
41pub use pictorial_bar::*;
42pub use pie::*;
43pub use radar::*;
44pub use sankey::*;
45pub use scatter::*;
46pub use sunburst::*;
47pub use theme_river::*;
48pub use tree::*;
49pub use treemap::*;
50
51pub enum Series {
52    Bar(bar::Bar),
53    Bar3d(bar3d::Bar3d),
54    Boxplot(boxplot::Boxplot),
55    Candlestick(candlestick::Candlestick),
56    Custom(custom::Custom),
57    EffectScatter(effect_scatter::EffectScatter),
58    Funnel(funnel::Funnel),
59    Gauge(gauge::Gauge),
60    Graph(graph::Graph),
61    Heatmap(heatmap::Heatmap),
62    Line(line::Line),
63    Map(map::Map),
64    Parallel(parallel::Parallel),
65    PictorialBar(pictorial_bar::PictorialBar),
66    Pie(pie::Pie),
67    Radar(radar::Radar),
68    Sankey(sankey::Sankey),
69    Scatter(scatter::Scatter),
70    Sunburst(sunburst::Sunburst),
71    ThemeRiver(theme_river::ThemeRiver),
72    Tree(tree::Tree),
73    Treemap(treemap::Treemap),
74}
75
76macro_rules! impl_series {
77    ($($variant:ident),*) => {
78        impl Serialize for Series {
79            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
80            where
81                S: serde::ser::Serializer,
82            {
83                match self {
84                    $(Self::$variant(series) => series.serialize(serializer),)*
85                }
86            }
87        }
88        $(
89            impl From<$variant> for Series {
90                fn from(series: $variant) -> Self {
91                    Self::$variant(series)
92                }
93            }
94        )*
95    }
96}
97
98impl_series!(
99    Bar,
100    Bar3d,
101    Boxplot,
102    Custom,
103    Candlestick,
104    EffectScatter,
105    Funnel,
106    Gauge,
107    Graph,
108    Heatmap,
109    Line,
110    Map,
111    Parallel,
112    PictorialBar,
113    Pie,
114    Radar,
115    Sankey,
116    Scatter,
117    Sunburst,
118    ThemeRiver,
119    Tree,
120    Treemap
121);