Skip to main content

lichtung_plot/data/
roles.rs

1//! Canonical authored data roles, independent of renderer field names.
2
3macro_rules! roles {
4    ($($variant:ident => $name:literal),+ $(,)?) => {
5        /// A fixed native input role, independent of its field name or display.
6        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7        #[non_exhaustive]
8        pub enum DataRole {
9            $(#[doc = concat!("Authored `", $name, "` input.")] $variant,)+
10        }
11
12        impl DataRole {
13            /// The canonical serialized spelling of this fixed role.
14            pub const fn as_str(self) -> &'static str {
15                match self {
16                    $(Self::$variant => $name,)+
17                }
18            }
19
20            /// Resolve a canonical role spelling at a typed language bridge.
21            #[doc(hidden)]
22            pub fn from_name(name: &str) -> Option<Self> {
23                match name {
24                    $($name => Some(Self::$variant),)+
25                    _ => None,
26                }
27            }
28        }
29    };
30}
31
32roles!(
33    X => "x",
34    Y => "y",
35    Z => "z",
36    Category => "category",
37    Value => "value",
38    Samples => "samples",
39    Estimate => "estimate",
40    Lower => "lower",
41    Upper => "upper",
42    Condition => "condition",
43    Term => "term",
44    Left => "left",
45    Right => "right",
46    Delta => "delta",
47    EstimateStatus => "estimate_status",
48    Group => "group",
49    Hue => "hue",
50    Series => "series",
51    FacetRow => "facet_row",
52    FacetColumn => "facet_column",
53    FacetWrap => "facet_wrap",
54    SamplingUnits => "sampling_units",
55    Weights => "weights",
56    CompareKey => "compare_key",
57    Split => "split",
58    Fill => "fill",
59    Color => "color",
60    AnnotationValues => "annotation_values",
61    DisplayMask => "display_mask",
62    HighlightCells => "highlight_cells",
63    Labels => "labels",
64    Text => "text",
65    Padding => "padding",
66    Position => "position",
67    Edges => "edges",
68    Height => "height",
69    Baseline => "baseline",
70    BarWidth => "bar_width",
71    BodyWidth => "body_width",
72    Gap => "gap",
73    Start => "start",
74    End => "end",
75    Duration => "duration",
76    First => "first",
77    Second => "second",
78    Where => "where",
79    Middle => "middle",
80    ErrorArms => "error_arms",
81    Density => "density",
82    Center => "center",
83    Count => "count",
84    Kde => "kde",
85    EvaluationGrid => "evaluation_grid",
86    Geometry => "geometry",
87    Summary => "summary",
88    Curves => "curves",
89    Variables => "variables",
90    Time => "time",
91    Lane => "lane",
92    LineOffsets => "line_offsets",
93    LineLengths => "line_lengths",
94    LaneLower => "lane_lower",
95    LaneHeight => "lane_height",
96    DecayTime => "decay_time",
97    Open => "open",
98    High => "high",
99    Low => "low",
100    Close => "close",
101    Signal => "signal",
102    Frequency => "frequency",
103    Other => "other",
104    Lag => "lag",
105    Field => "field",
106    Mesh => "mesh",
107    Pixels => "pixels",
108    Grid => "grid",
109    Sparsity => "sparsity",
110    RowColors => "row_colors",
111    ColumnColors => "column_colors",
112    RowOrder => "row_order",
113    ColumnOrder => "column_order",
114    Observed => "observed",
115    Theoretical => "theoretical",
116    PlottingPositions => "plotting_positions",
117    Reference => "reference",
118    Covariance => "covariance",
119    FitResult => "fit_result",
120    Fitted => "fitted",
121    Residual => "residual",
122    Successes => "successes",
123    Trials => "trials",
124    JointPredictor => "joint_predictor",
125    CovariateAdjustment => "covariate_adjustment",
126    PredictionGrid => "prediction_grid",
127    QuantileLevel => "quantile_level",
128    Offset => "offset",
129    Exposure => "exposure",
130    Scores => "scores",
131    Thresholds => "thresholds",
132    Fpr => "fpr",
133    Tpr => "tpr",
134    Recall => "recall",
135    Precision => "precision",
136    MeanProbability => "mean_probability",
137    FractionPositive => "fraction_positive",
138    Probability => "probability",
139    Event => "event",
140    Entry => "entry",
141    Censors => "censors",
142    RiskTable => "risk_table",
143    Effect => "effect",
144    PValues => "p_values",
145    AdjustedPValues => "adjusted_p_values",
146    NegativeLog10 => "negative_log10",
147    Mean => "mean",
148    Difference => "difference",
149    Bias => "bias",
150    DeltaValue => "delta_value",
151    Theta => "theta",
152    R => "r",
153    AngularWidth => "angular_width",
154    Explode => "explode",
155    Direction => "direction",
156    Speed => "speed",
157    AngularEdges => "angular_edges",
158    SpeedEdges => "speed_edges",
159    Mass => "mass",
160    CalmMass => "calm_mass",
161    SectorMass => "sector_mass",
162    WeibullScale => "weibull_scale",
163    WeibullShape => "weibull_shape",
164    Flags => "flags",
165    Full => "full",
166    Half => "half",
167    Composition => "composition",
168    Dimensions => "dimensions",
169    Stages => "stages",
170    Graph => "graph",
171    Tree => "tree",
172    Process => "process",
173    Port => "port",
174    Flow => "flow",
175    Connections => "connections",
176    Stage => "stage",
177    Features => "features",
178    Tiles => "tiles",
179    Lon => "lon",
180    Lat => "lat",
181    Radius => "radius",
182    LabelPositions => "label_positions",
183    Dx => "dx",
184    Dy => "dy",
185    Dz => "dz",
186    Vertices => "vertices",
187    VertexValues => "vertex_values",
188    FaceValues => "face_values",
189    Occupied => "occupied",
190    XEdges => "x_edges",
191    YEdges => "y_edges",
192    ZEdges => "z_edges",
193    XCorners => "x_corners",
194    YCorners => "y_corners",
195    ZCorners => "z_corners",
196    Seeds => "seeds",
197    Paths => "paths",
198    MeshMarker => "mesh_marker",
199    MarkerRotation => "marker_rotation",
200    MarkerScale => "marker_scale",
201    X0 => "x0",
202    Y0 => "y0",
203    X1 => "x1",
204    Y1 => "y1",
205    Stop => "stop",
206    Sweep => "sweep",
207    NotchLower => "notch_lower",
208    NotchUpper => "notch_upper",
209    NormalError => "normal_error",
210    Normals => "normals",
211    Measure => "measure",
212    PointColor => "point_color",
213    LineColor => "line_color",
214    FillColor => "fill_color",
215    EdgeColor => "edge_color",
216    TextColor => "text_color",
217    PointSize => "point_size",
218    PointShape => "point_shape",
219    LineWidth => "line_width",
220    LinePattern => "line_pattern",
221    FillPattern => "fill_pattern",
222    EdgeWidth => "edge_width",
223    FontSize => "font_size",
224    Rotation => "rotation",
225    HatchSpacing => "hatch_spacing",
226    VectorLength => "vector_length",
227    TubeRadius => "tube_radius",
228    FlowWidth => "flow_width",
229    PointAlpha => "point_alpha",
230    LineAlpha => "line_alpha",
231    FillAlpha => "fill_alpha",
232    EdgeAlpha => "edge_alpha",
233    TextAlpha => "text_alpha",
234    SetMembership => "set_membership",
235    SegmentRanges => "segment_ranges",
236    Sector => "sector",
237    CircularLinks => "circular_links",
238    StandardError => "standard_error",
239    Variance => "variance",
240    Intervals => "intervals",
241    QuantileProbabilities => "quantile_probabilities",
242    QuantileValues => "quantile_values",
243    StandardDeviation => "standard_deviation",
244    Correlation => "correlation",
245    CenteredRmse => "centered_rmse",
246    Loadings => "loadings",
247    SingularValues => "singular_values",
248    ExplainedVariance => "explained_variance",
249    Chromosome => "chromosome",
250    Response => "response",
251    TrueLabels => "true_labels",
252    PredictedLabels => "predicted_labels",
253    Individual => "individual",
254    RugValues => "rug_values",
255    EventCode => "event_code",
256    CumulativeHazard => "cumulative_hazard",
257    CumulativeIncidence => "cumulative_incidence",
258);