Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: Resolved this warning associated with a "Non-Standard" default #510

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions plotters-backend/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ impl<'a> From<&'a str> for FontFamily<'a> {
/// ```
pub mod text_anchor {
/// The horizontal position of the anchor point relative to the text.
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Default)]
pub enum HPos {
/// Anchor point is on the left side of the text
#[default]
Left,
/// Anchor point is on the right side of the text
Right,
Expand All @@ -71,9 +72,10 @@ pub mod text_anchor {
}

/// The vertical position of the anchor point relative to the text.
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Default)]
pub enum VPos {
/// Anchor point is on the top of the text
#[default]
Top,
/// Anchor point is in the vertical center of the text
Center,
Expand All @@ -82,7 +84,7 @@ pub mod text_anchor {
}

/// The text anchor position.
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Default)]
pub struct Pos {
/// The horizontal position of the anchor point
pub h_pos: HPos,
Expand All @@ -106,21 +108,6 @@ pub mod text_anchor {
Pos { h_pos, v_pos }
}

/// Create a default text anchor position (top left).
///
/// - **returns** The default text anchor position
///
/// ```rust
/// use plotters_backend::text_anchor::{Pos, HPos, VPos};
///
/// let pos = Pos::default();
/// ```
pub fn default() -> Self {
Pos {
h_pos: HPos::Left,
v_pos: VPos::Top,
}
}
}
}

Expand Down
Loading