From 232449b6baf9b97572b1b1f2095e051f40dde7e5 Mon Sep 17 00:00:00 2001 From: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com> Date: Mon, 13 Jan 2025 08:45:40 +0100 Subject: [PATCH] make scatter trace specific types public Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com> --- plotly/src/lib.rs | 3 ++- plotly/src/traces/mod.rs | 4 ++-- plotly_derive/src/field_setter.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plotly/src/lib.rs b/plotly/src/lib.rs index c9d89c40..9d331d92 100644 --- a/plotly/src/lib.rs +++ b/plotly/src/lib.rs @@ -31,7 +31,8 @@ pub use layout::Layout; pub use plot::{ImageFormat, Plot, Trace}; // Also provide easy access to modules which contain additional trace-specific types pub use traces::{ - box_plot, contour, heat_map, histogram, image, mesh3d, sankey, scatter_mapbox, surface, + box_plot, contour, heat_map, histogram, image, mesh3d, sankey, scatter, scatter3d, + scatter_mapbox, surface, }; // Bring the different trace types into the top-level scope pub use traces::{ diff --git a/plotly/src/traces/mod.rs b/plotly/src/traces/mod.rs index 515072b2..2a2d3042 100644 --- a/plotly/src/traces/mod.rs +++ b/plotly/src/traces/mod.rs @@ -12,8 +12,8 @@ pub mod mesh3d; mod ohlc; pub mod pie; pub mod sankey; -mod scatter; -mod scatter3d; +pub mod scatter; +pub mod scatter3d; pub mod scatter_mapbox; mod scatter_polar; pub mod surface; diff --git a/plotly_derive/src/field_setter.rs b/plotly_derive/src/field_setter.rs index ca13d1d3..426d18fa 100644 --- a/plotly_derive/src/field_setter.rs +++ b/plotly_derive/src/field_setter.rs @@ -213,7 +213,7 @@ impl FieldType { // Not the best implementation but works in practice let (type_str_parts, types) = _type_str_parts(field_ty); - if type_str_parts.first().map_or(false, |t| t != "Option") { + if type_str_parts.first().is_some_and(|t| t != "Option") { return FieldType::NotOption; } @@ -507,7 +507,7 @@ impl FieldReceiver { attr.path() .segments .first() - .map_or(false, |p| p.ident == name) + .is_some_and(|p| p.ident == name) }) .map(|attr| { quote![