From e748c640808007790bb70ae2ef6b5d97507fc60e Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 26 Aug 2024 16:31:34 +0000 Subject: [PATCH 1/2] Update to bon 2.0 --- Cargo.lock | 6 ++---- Cargo.toml | 2 +- README.md | 8 ++++---- src/lib.rs | 8 ++++---- src/traces/barplot.rs | 4 ++-- src/traces/boxplot.rs | 4 ++-- src/traces/lineplot.rs | 2 +- src/traces/scatterplot.rs | 2 +- src/traces/timeseriesplot.rs | 2 +- 9 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ffbcfc9..359214d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,8 +151,7 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bon" version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e4c5fa2da1ff5ce802338a5c34eb28c62da9d6144d1f52612473dbbc7b3a51" +source = "git+https://github.com/elastio/bon#c5285102fd9f9fdec0b467d2f75eb8a18bf03c6e" dependencies = [ "bon-macros", ] @@ -160,8 +159,7 @@ dependencies = [ [[package]] name = "bon-macros" version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c378eb299098565855276f54d0c01cbee8af3eaea1722f37dcedce2aebd5bb3" +source = "git+https://github.com/elastio/bon#c5285102fd9f9fdec0b467d2f75eb8a18bf03c6e" dependencies = [ "darling", "ident_case", diff --git a/Cargo.toml b/Cargo.toml index 55091b4..7f13a99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["chart", "plot", "plotly", "polars", "visualization"] categories = ["visualization"] [dependencies] -bon = "1.2.0" +bon = { git = "https://github.com/elastio/bon" } plotly = "0.9.0" polars = { version = "0.42", features = ["dtype-categorical", "lazy", "strings"] } serde = "1.0.208" diff --git a/README.md b/README.md index 1160f44..09d85f0 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,10 @@ fn main() { .unique().unwrap(); let layout = Layout::new() - .title(Title::new("Penguin Flipper Length vs Body Mass")) - .x_axis(Axis::new().title(Title::new("Body Mass (g)"))) - .y_axis(Axis::new().title(Title::new("Flipper Length (mm)"))) - .legend(Legend::new().title(Title::new("Species"))); + .title(Title::with_text("Penguin Flipper Length vs Body Mass")) + .x_axis(Axis::new().title(Title::with_text("Body Mass (g)"))) + .y_axis(Axis::new().title(Title::with_text("Flipper Length (mm)"))) + .legend(Legend::new().title(Title::with_text("Species"))); let mut plot = Plot::new(); plot.set_layout(layout); diff --git a/src/lib.rs b/src/lib.rs index 1dccb06..e576801 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,10 +52,10 @@ //! .unique().unwrap(); //! //! let layout = Layout::new() -//! .title(Title::new("Penguin Flipper Length vs Body Mass")) -//! .x_axis(Axis::new().title(Title::new("Body Mass (g)"))) -//! .y_axis(Axis::new().title(Title::new("Flipper Length (mm)"))) -//! .legend(Legend::new().title(Title::new("Species"))); +//! .title(Title::with_text("Penguin Flipper Length vs Body Mass")) +//! .x_axis(Axis::new().title(Title::with_text("Body Mass (g)"))) +//! .y_axis(Axis::new().title(Title::with_text("Flipper Length (mm)"))) +//! .legend(Legend::new().title(Title::with_text("Species"))); //! //! let mut plot = Plot::new(); //! plot.set_layout(layout); diff --git a/src/traces/barplot.rs b/src/traces/barplot.rs index 5fd6aa9..f0a75ba 100644 --- a/src/traces/barplot.rs +++ b/src/traces/barplot.rs @@ -88,7 +88,7 @@ impl VerticalBarPlot { /// /// ![Vertical Bar Plot](https://imgur.com/Fd6DpB0.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( data: &DataFrame, x: String, @@ -258,7 +258,7 @@ impl HorizontalBarPlot { /// /// ![Horizontal Bar Plot](https://imgur.com/saoTcNg.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( data: &DataFrame, x: String, diff --git a/src/traces/boxplot.rs b/src/traces/boxplot.rs index 95fc227..93c7c82 100644 --- a/src/traces/boxplot.rs +++ b/src/traces/boxplot.rs @@ -96,7 +96,7 @@ impl VerticalBoxPlot { /// /// ![Vertical Box Plot](https://imgur.com/0Zn0mFu.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( data: &DataFrame, x: String, @@ -281,7 +281,7 @@ impl HorizontalBoxPlot { /// /// ![Horizontal Box Plot](https://imgur.com/Lu92liU.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( data: &DataFrame, x: String, diff --git a/src/traces/lineplot.rs b/src/traces/lineplot.rs index f24c68d..2e36d01 100644 --- a/src/traces/lineplot.rs +++ b/src/traces/lineplot.rs @@ -93,7 +93,7 @@ impl LinePlot { /// /// ![Line Plot](https://imgur.com/cOH707b.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( // Data data: &DataFrame, diff --git a/src/traces/scatterplot.rs b/src/traces/scatterplot.rs index 66e5cf0..2f1a0d8 100644 --- a/src/traces/scatterplot.rs +++ b/src/traces/scatterplot.rs @@ -86,7 +86,7 @@ impl ScatterPlot { /// /// ![Scatter Plot](https://imgur.com/f5vgrNd.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( // Data data: &DataFrame, diff --git a/src/traces/timeseriesplot.rs b/src/traces/timeseriesplot.rs index 8b99bfe..f69d940 100644 --- a/src/traces/timeseriesplot.rs +++ b/src/traces/timeseriesplot.rs @@ -93,7 +93,7 @@ impl TimeSeriesPlot { /// /// ![Time Series Plot](https://imgur.com/sjxJ2og.png) /// - #[builder] + #[builder(on(String, into), on(Text, into))] pub fn new( // Data data: &DataFrame, From c52b692e00ac7783a3ef6e84f24d691fe94eb111 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 26 Aug 2024 19:13:37 +0000 Subject: [PATCH 2/2] Use the released verison of `bon` --- Cargo.lock | 10 ++++++---- Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 359214d..f1c46f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,16 +150,18 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bon" -version = "1.2.1" -source = "git+https://github.com/elastio/bon#c5285102fd9f9fdec0b467d2f75eb8a18bf03c6e" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea8256e3cff531086cc3faf94c1649930ff64bceb2d0e8cc84fc0356d7ee9806" dependencies = [ "bon-macros", ] [[package]] name = "bon-macros" -version = "1.2.1" -source = "git+https://github.com/elastio/bon#c5285102fd9f9fdec0b467d2f75eb8a18bf03c6e" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99838f77c5073bc7846ecce92b64e7e5a5bd152a8ec392facf90ee4d90b4b35" dependencies = [ "darling", "ident_case", diff --git a/Cargo.toml b/Cargo.toml index 7f13a99..0e701b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["chart", "plot", "plotly", "polars", "visualization"] categories = ["visualization"] [dependencies] -bon = { git = "https://github.com/elastio/bon" } +bon = "2.0.0" plotly = "0.9.0" polars = { version = "0.42", features = ["dtype-categorical", "lazy", "strings"] } serde = "1.0.208"