From d4da98e0a186bbed28f8af315376d5871111814e Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 10:56:55 -0400 Subject: [PATCH] decided to feature gate the tables API --- imgui-examples/Cargo.toml | 2 +- imgui/Cargo.toml | 3 +++ imgui/src/lib.rs | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/imgui-examples/Cargo.toml b/imgui-examples/Cargo.toml index 40c00b7..87950d2 100644 --- a/imgui-examples/Cargo.toml +++ b/imgui-examples/Cargo.toml @@ -13,6 +13,6 @@ publish = false clipboard = "0.5" glium = { version = "0.30", default-features = true } image = "0.23" -imgui = { path = "../imgui" } +imgui = { path = "../imgui", features = ["tables-api"] } imgui-glium-renderer = { path = "../imgui-glium-renderer" } imgui-winit-support = { path = "../imgui-winit-support" } diff --git a/imgui/Cargo.toml b/imgui/Cargo.toml index ec52b38..b3f5603 100644 --- a/imgui/Cargo.toml +++ b/imgui/Cargo.toml @@ -23,6 +23,9 @@ default = ["min-const-generics"] wasm = ["imgui-sys/wasm"] freetype = ["imgui-sys/freetype"] min-const-generics = [] +# this api is in beta in the upstream imgui crate. See issue #524 for more info. +# it should be stable and fine to use though. +tables-api = [] [dev-dependencies] memoffset = "0.6" diff --git a/imgui/src/lib.rs b/imgui/src/lib.rs index 02c73ef..929636e 100644 --- a/imgui/src/lib.rs +++ b/imgui/src/lib.rs @@ -34,6 +34,8 @@ pub use self::render::renderer::*; pub use self::stacks::*; pub use self::string::*; pub use self::style::*; + +#[cfg(feature = "tables-api")] pub use self::tables::*; pub use self::utils::*; pub use self::widget::color_editors::*; @@ -77,6 +79,7 @@ mod popups; mod render; mod stacks; mod style; +#[cfg(feature = "tables-api")] mod tables; #[cfg(test)] mod test; @@ -289,6 +292,9 @@ impl From<*mut T> for Id<'static> { } impl<'a> Id<'a> { + // this is used in the tables-api and possibly elsewhere, + // but not with just default features... + #[allow(dead_code)] fn as_imgui_id(&self) -> sys::ImGuiID { unsafe { match self {