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

[Feature Request] Unify argument style of LineSeries::new and DashedLineSeries::new #666

Open
duskmoon314 opened this issue Dec 21, 2024 · 1 comment

Comments

@duskmoon314
Copy link

What is the feature?

Currently, LineSeries::new and DashedLineSeries::new have different signature of style:

// LineSeries::new
pub fn new<I: IntoIterator<Item = Coord>, S: Into<ShapeStyle>>(iter: I, style: S) -> Self

// DashedLineSeries::new
pub fn new<I0>(points: I0, size: Size, spacing: Size, style: ShapeStyle) -> Self

I suggest adjusting the latter to:

pub fn new<I0, S: Into<ShapeStyle>>(points: I0, size: Size, spacing: Size, style: S) -> Self 

(Optional) Why is this feature useful, and how would people use the feature?

Some other series share the same signature with LineSeries::new:

// PointSeries
pub fn new<S: Into<ShapeStyle>>(iter: I, size: Size, style: S) -> Self

// AreaSeries
pub fn new<S: Into<ShapeStyle>, I: IntoIterator<Item = (X, Y)>>(
        iter: I,
        baseline: Y,
        area_style: S,
    ) -> Self

This FR lets users expect a similar API when using DashedLineSeries.

(Optional) Additional Information

This will cause a breaking if the user previously passes some_style.into() to DashedLineSeries::new, which will get an error from rustc (type annotations needed cannot satisfy _: Into<ShapeStyle>).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
@duskmoon314 and others