Skip to content

Commit

Permalink
Merge pull request #3 from clementwanjau/v0.1.3
Browse files Browse the repository at this point in the history
Export the types in a prelude module.
  • Loading branch information
clementwanjau authored May 4, 2024
2 parents 01befc2 + a7754c1 commit ab3b712
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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#"
Expand All @@ -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");
}
```
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
4 changes: 2 additions & 2 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl From<ChartSeries> for JsValue {
#[cfg(test)]
mod tests {
use serde_json::Value;
use crate::{ChartOptions};
use crate::prelude::{ChartOptions, ChartType};

const OPTIONS_STR: &str = r#"
{
Expand All @@ -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::<Value>(r#"
{
"chart": {
Expand Down

0 comments on commit ab3b712

Please sign in to comment.