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

Export the types in a prelude module. #3

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
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
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
Loading