diff --git a/src/context.rs b/src/context.rs index 054500b..597b11d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -12,6 +12,7 @@ use crate::PlotUi; /// implicitly in earlier versions of the library, it is now created explicitly. These contexts /// cannot currently be disabled through the high level API. This could be implemented though, /// if you need multiple contexts that you can switch around between, file an issue. +#[rustversion::attr(since(1.48), doc(alias = "ImPlotContext"))] pub struct Context { raw: *mut sys::ImPlotContext, } diff --git a/src/lib.rs b/src/lib.rs index 5accc9e..1979557 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,10 @@ //! you'd really like a particular feature, file an issue and it'll be given priority for wrapping, //! or directly contribute a PR, or use the low-level bindings directly for the time being. //! +//! If you've seen a construct or feature in C++ implot and can't find it here, try searching for +//! the C++ name - some doc aliases are defined to increase the chances of that working. If this +//! does not yield any results, you can also try cloning the source and doing a full-text search to +//! see if the feature is used somewhere internally the code. use implot_sys as sys; // TODO(4bb4) facade-wrap these? @@ -46,6 +50,7 @@ pub enum YAxisChoice { } /// Turn an Option into an i32. Picks IMPLOT_AUTO for None. +#[rustversion::attr(since(1.48), doc(alias = "IMPLOT_AUTO"))] fn y_axis_choice_option_to_i32(y_axis_choice: Option) -> i32 { match y_axis_choice { Some(choice) => choice as i32, @@ -333,6 +338,7 @@ pub struct StyleColorToken { } impl StyleColorToken { + #[rustversion::attr(since(1.48), doc(alias = "PopStyleColor"))] pub fn pop(mut self) { if self.was_popped { panic!("Attempted to pop a style color token twice.") @@ -393,6 +399,7 @@ pub struct StyleVarToken { impl StyleVarToken { /// Pop this token from the stack. + #[rustversion::attr(since(1.48), doc(alias = "PopStyleVar"))] pub fn pop(mut self) { if self.was_popped { panic!("Attempted to pop a style var token twice.") diff --git a/src/plot.rs b/src/plot.rs index 0bc9835..9d787dd 100644 --- a/src/plot.rs +++ b/src/plot.rs @@ -12,6 +12,7 @@ pub use sys::{ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4}; const DEFAULT_PLOT_SIZE_X: f32 = 400.0; const DEFAULT_PLOT_SIZE_Y: f32 = 400.0; +#[rustversion::attr(since(1.48), doc(alias = "ImPlotFlags"))] bitflags! { /// Flags for customizing plot behavior and interaction. Documentation copied from implot.h for /// convenience. ImPlot itself also has a "CanvasOnly" flag, which can be emulated here with @@ -48,6 +49,7 @@ bitflags! { } } +#[rustversion::attr(since(1.48), doc(alias = "ImPlotAxisFlags"))] bitflags! { /// Axis flags. Documentation copied from implot.h for convenience. ImPlot itself also /// has `Lock`, which combines `LOCK_MIN` and `LOCK_MAX`, and `NoDecorations`, which combines @@ -309,6 +311,7 @@ impl Plot { } /// Set the legend location, orientation and whether it is to be drawn outside the plot + #[rustversion::attr(since(1.48), doc(alias = "SetLegendLocation"))] #[inline] pub fn with_legend_location( mut self, @@ -414,6 +417,7 @@ impl Plot { /// /// For a convenient implementation of all this, use [`build()`](struct.Plot.html#method.build) /// instead. + #[rustversion::attr(since(1.48), doc(alias = "BeginPlot"))] pub fn begin(&self, plot_ui: &PlotUi) -> Option { self.maybe_set_axis_limits(); self.maybe_set_tick_labels(); @@ -463,10 +467,13 @@ impl Plot { } } - /// Creates a window and runs a closure to construct the contents. + /// Creates a window and runs a closure to construct the contents. This internally + /// calls `begin` and `end`. /// /// Note: the closure is not called if ImPlot::BeginPlot() returned /// false - TODO(4bb4) figure out if this is if things are not rendered + #[rustversion::attr(since(1.48), doc(alias = "BeginPlot"))] + #[rustversion::attr(since(1.48), doc(alias = "EndPlot"))] pub fn build(self, plot_ui: &PlotUi, f: F) { if let Some(token) = self.begin(plot_ui) { f(); @@ -484,6 +491,7 @@ pub struct PlotToken { impl PlotToken { /// End a previously begin()'ed plot. + #[rustversion::attr(since(1.48), doc(alias = "EndPlot"))] pub fn end(mut self) { self.context = std::ptr::null(); unsafe { sys::ImPlot_EndPlot() };