@@ -60,10 +60,11 @@ impl<'a> From<&'a str> for FontFamily<'a> {
6060/// ```
6161pub mod text_anchor {
6262 /// The horizontal position of the anchor point relative to the text.
63- #[ derive( Clone , Copy ) ]
63+ #[ derive( Default , Clone , Copy ) ]
6464 pub enum HPos {
6565 /// Default value (Left), except chart axes that might provide a different pos.
6666 /// Use another variant to override the default positionning
67+ #[ default]
6768 Default ,
6869 /// Anchor point is on the left side of the text
6970 Left ,
@@ -74,10 +75,11 @@ pub mod text_anchor {
7475 }
7576
7677 /// The vertical position of the anchor point relative to the text.
77- #[ derive( Clone , Copy ) ]
78+ #[ derive( Default , Clone , Copy ) ]
7879 pub enum VPos {
7980 /// Default value (Top), except chart axes that might provide a different pos
8081 /// Use another variant to override the default positionning
82+ #[ default]
8183 Default ,
8284 /// Anchor point is on the top of the text
8385 Top ,
@@ -88,7 +90,7 @@ pub mod text_anchor {
8890 }
8991
9092 /// The text anchor position.
91- #[ derive( Clone , Copy ) ]
93+ #[ derive( Default , Clone , Copy ) ]
9294 pub struct Pos {
9395 /// The horizontal position of the anchor point
9496 pub h_pos : HPos ,
@@ -111,22 +113,6 @@ pub mod text_anchor {
111113 pub fn new ( h_pos : HPos , v_pos : VPos ) -> Self {
112114 Pos { h_pos, v_pos }
113115 }
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- }
130116 }
131117}
132118
0 commit comments