Skip to content

Commit

Permalink
Merge pull request #121 from LukaOber/element_label_copy
Browse files Browse the repository at this point in the history
Implement copy for all available enums
  • Loading branch information
LukaOber authored Nov 11, 2024
2 parents c3f00c4 + 6c9fb80 commit 1b16135
Show file tree
Hide file tree
Showing 36 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions charming/src/component/data_zoom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{Color, DataBackground, Orient, TextStyle},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "camelCase")]
pub enum FilterMode {
Filter,
Expand All @@ -14,7 +14,7 @@ pub enum FilterMode {
None,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum DataZoomType {
Inside,
Expand Down
4 changes: 2 additions & 2 deletions charming/src/component/legend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
element::{Color, Icon, ItemStyle, LabelAlign, LineStyle, Orient, Padding, TextStyle},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum LegendType {
/// Simple legend.
Expand All @@ -17,7 +17,7 @@ pub enum LegendType {
Scroll,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum LegendSelectedMode {
/// Multiple selection.
Expand Down
2 changes: 1 addition & 1 deletion charming/src/component/single_axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use crate::{datatype::CompositeValue, element::Orient};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Type {
Value,
Expand Down
6 changes: 3 additions & 3 deletions charming/src/component/toolbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use crate::{datatype::CompositeValue, element::Orient};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum SaveAsImageType {
Png,
Expand Down Expand Up @@ -143,7 +143,7 @@ impl DataView {
}
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum MagicTypeType {
/// For line charts.
Expand Down Expand Up @@ -200,7 +200,7 @@ impl MagicType {
}
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "camelCase")]
pub enum BrushType {
Rect,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/component/visual_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{Color, Orient, TextStyle},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum VisualMapType {
Continuous,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/datatype/dimension.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(untagged)]
pub enum DimensionType {
Number,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/datatype/value.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[serde(untagged)]
pub enum NumericValue {
Integer(i64),
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/area_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use super::color::Color;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum OriginPosition {
Auto,
Expand Down
4 changes: 2 additions & 2 deletions charming/src/element/axis_pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{Label, LineStyle},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum AxisPointerType {
Line,
Expand All @@ -14,7 +14,7 @@ pub enum AxisPointerType {
None,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum AxisPointerAxis {
X,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/axis_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::Serialize;

/// Type of axis.
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum AxisType {
/// Numerical axis, suitable for continuous data.
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/border_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum BorderType {
Solid,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/color.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::ser::{SerializeStruct, Serializer};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum ColorBy {
Series,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/coordinate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum CoordinateSystem {
Cartesian2d,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Cursor {
Pointer,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/emphasis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use super::{item_style::ItemStyle, AreaStyle, Label};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum EmphasisFocus {
None,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/font_settings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "camelCase")]
pub enum FontStyle {
Normal,
Expand Down
6 changes: 3 additions & 3 deletions charming/src/element/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{
Formatter,
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "camelCase")]
pub enum LabelPosition {
Top,
Expand All @@ -29,15 +29,15 @@ pub enum LabelPosition {
Center,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum LabelAlign {
Left,
Center,
Right,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum LabelVerticalAlign {
Top,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/line_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use super::color::Color;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum LineStyleType {
Solid,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/link_target.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum LinkTarget {
#[serde(rename = "self")]
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/mark_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::datatype::CompositeValue;

use super::{label::Label, line_style::LineStyle, symbol::Symbol};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum MarkLineDataType {
Min,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/mark_point.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum MarkPointDataType {
Min,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/name_location.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum NameLocation {
Start,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/orient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Orient {
Horizontal,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/parallel_layout.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum ParallelLayout {
Horizontal,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/shape.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Shape {
Polygon,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/smoothness.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Debug, PartialEq, PartialOrd, Clone)]
#[derive(Debug, PartialEq, PartialOrd, Clone, Copy)]
pub enum Smoothness {
Single(f64),
Boolean(bool),
Expand Down
2 changes: 1 addition & 1 deletion charming/src/element/sort.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Debug, PartialEq, PartialOrd, Clone)]
#[derive(Debug, PartialEq, PartialOrd, Clone, Copy)]
pub enum Sort {
Ascending,
Descending,
Expand Down
4 changes: 2 additions & 2 deletions charming/src/element/text_align.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum TextAlign {
Auto,
Expand All @@ -9,7 +9,7 @@ pub enum TextAlign {
Center,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum TextVerticalAlign {
Auto,
Expand Down
4 changes: 2 additions & 2 deletions charming/src/element/tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use crate::element::{AxisPointer, Color, Formatter, Padding};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum TriggerOn {
Mousemove,
Expand All @@ -13,7 +13,7 @@ pub enum TriggerOn {
}

/// Types of triggering.
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Trigger {
Item,
Expand Down
6 changes: 3 additions & 3 deletions charming/src/series/effect_scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ use crate::{
},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum EffectType {
Ripple,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum ShowEffectOn {
Render,
Emphasis,
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum RippleEffectBrushType {
Fill,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/series/funnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{ColorBy, Emphasis, ItemStyle, Label, LabelLine, Orient, Sort, Tooltip},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum Align {
Left,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/series/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl GraphLayoutForce {
}
}

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum GraphLayout {
None,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/series/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{smoothness::Smoothness, ColorBy, CoordinateSystem, Emphasis, LineStyle},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum ProgressiveChunkMode {
Sequential,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/series/pie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{ColorBy, CoordinateSystem, Emphasis, ItemStyle, Label, LabelLine, Tooltip},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum PieRoseType {
Radius,
Expand Down
2 changes: 1 addition & 1 deletion charming/src/series/sankey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
element::{Emphasis, ItemStyle, Label, LineStyle, Orient, Tooltip},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum SankeyNodeAlign {
Left,
Expand Down
Loading

0 comments on commit 1b16135

Please sign in to comment.