@@ -60,10 +60,11 @@ impl<'a> From<&'a str> for FontFamily<'a> {
60
60
/// ```
61
61
pub mod text_anchor {
62
62
/// The horizontal position of the anchor point relative to the text.
63
- #[ derive( Clone , Copy ) ]
63
+ #[ derive( Default , Clone , Copy ) ]
64
64
pub enum HPos {
65
65
/// Default value (Left), except chart axes that might provide a different pos.
66
66
/// Use another variant to override the default positionning
67
+ #[ default]
67
68
Default ,
68
69
/// Anchor point is on the left side of the text
69
70
Left ,
@@ -74,10 +75,11 @@ pub mod text_anchor {
74
75
}
75
76
76
77
/// The vertical position of the anchor point relative to the text.
77
- #[ derive( Clone , Copy ) ]
78
+ #[ derive( Default , Clone , Copy ) ]
78
79
pub enum VPos {
79
80
/// Default value (Top), except chart axes that might provide a different pos
80
81
/// Use another variant to override the default positionning
82
+ #[ default]
81
83
Default ,
82
84
/// Anchor point is on the top of the text
83
85
Top ,
@@ -88,7 +90,7 @@ pub mod text_anchor {
88
90
}
89
91
90
92
/// The text anchor position.
91
- #[ derive( Clone , Copy ) ]
93
+ #[ derive( Default , Clone , Copy ) ]
92
94
pub struct Pos {
93
95
/// The horizontal position of the anchor point
94
96
pub h_pos : HPos ,
@@ -111,22 +113,6 @@ pub mod text_anchor {
111
113
pub fn new ( h_pos : HPos , v_pos : VPos ) -> Self {
112
114
Pos { h_pos, v_pos }
113
115
}
114
-
115
- /// Create a default text anchor position (top left).
116
- ///
117
- /// - **returns** The default text anchor position
118
- ///
119
- /// ```rust
120
- /// use plotters_backend::text_anchor::{Pos, HPos, VPos};
121
- ///
122
- /// let pos = Pos::default();
123
- /// ```
124
- pub fn default ( ) -> Self {
125
- Pos {
126
- h_pos : HPos :: Default ,
127
- v_pos : VPos :: Default ,
128
- }
129
- }
130
116
}
131
117
}
132
118
0 commit comments