diff --git a/README.md b/README.md index a8d1cc5..fbb79c9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ apexcharts-rs = "0.1.3" and then in your code: ```rust -use apexcharts_rs::ApexCharts; +use apexcharts_rs::ApexChart; fn main() { let options = r#" @@ -30,7 +30,7 @@ fn main() { } "#; let options = ChartOptions(String::from(options)); - let chart = ApexCharts::new(&options.into()); + let chart = ApexChart::new(&options.into()); chart.render("chart_el_id"); } ``` diff --git a/src/lib.rs b/src/lib.rs index 650ae31..93ba0ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,5 +3,7 @@ mod options; mod bindings; -pub use crate::bindings::ApexChart; -pub use crate::options::{ChartOptions, ChartType, ChartSeries, SeriesData}; +pub mod prelude { + pub use crate::bindings::ApexChart; + pub use crate::options::{ChartOptions, ChartType, ChartSeries, SeriesData}; +} diff --git a/src/options.rs b/src/options.rs index 5f9d951..d3294c6 100644 --- a/src/options.rs +++ b/src/options.rs @@ -205,7 +205,7 @@ impl From for JsValue { #[cfg(test)] mod tests { use serde_json::Value; - use crate::{ChartOptions}; + use crate::prelude::{ChartOptions, ChartType}; const OPTIONS_STR: &str = r#" { @@ -229,7 +229,7 @@ mod tests { #[test] pub fn test_setting_chart_type() { let options = ChartOptions::from_string(String::from(OPTIONS_STR)) - .set_chart_type(crate::ChartType::Bar); + .set_chart_type(ChartType::Bar); let new_options = serde_json::from_str::(r#" { "chart": {