dear_imnodes/
lib.rs

1//! Dear ImNodes - Rust Bindings with Dear ImGui Compatibility
2//!
3//! High-level Rust bindings for ImNodes, the node editor for Dear ImGui.
4//! This crate follows the same patterns as our `dear-implot` and `dear-imguizmo`
5//! crates: Ui extensions, RAII tokens, and strongly-typed flags/enums.
6
7use dear_imnodes_sys as sys;
8
9// Similar to ImGui 1.92+ return-by-value changes, generated bindings for
10// `dear-imnodes-sys` may exist in the build directory in both the legacy
11// out-parameter form and the newer return-by-value form. rust-analyzer can end
12// up indexing the wrong `OUT_DIR` and report spurious signature errors.
13//
14// Keep the high-level wrapper stable by calling local extern declarations for
15// the return-by-value APIs we expose.
16#[allow(non_snake_case)]
17pub(crate) mod compat_ffi {
18    use super::sys;
19
20    unsafe extern "C" {
21        pub fn imnodes_EditorContextGetPanning() -> sys::ImVec2;
22        pub fn imnodes_GetNodeScreenSpacePos(node_id: i32) -> sys::ImVec2;
23        pub fn imnodes_GetNodeEditorSpacePos(node_id: i32) -> sys::ImVec2;
24        pub fn imnodes_GetNodeDimensions(node_id: i32) -> sys::ImVec2;
25    }
26}
27
28mod context;
29mod style;
30mod types;
31mod ui_ext;
32
33pub use context::*;
34pub use style::*;
35pub use types::*;
36pub use ui_ext::*;