4 releases

0.1.3 Feb 22, 2022
0.1.2 Feb 8, 2022
0.1.1 Feb 1, 2022
0.1.0 Feb 1, 2022

#25 in #derived

Download history 2/week @ 2023-12-04 24/week @ 2023-12-11 8/week @ 2023-12-18 4/week @ 2023-12-25 8/week @ 2024-02-12 20/week @ 2024-02-19 23/week @ 2024-02-26 17/week @ 2024-03-04 29/week @ 2024-03-11 8/week @ 2024-03-18

79 downloads per month
Used in egui_inspect

MIT license

11KB
254 lines

egui_inspect

crates.io crates.io

This crate is intended to provide some rust helper macros to automatically generate boilerplate code to inspect structures

Its goals are:

  • to provide as much compile-time generated code as possible, avoiding conditional branches at runtime
  • to be hyper user-friendly

There is a EguiInspect trait which is necessary for a struct to be inspected. This trait is implemented for most base types, and can be generated for user created types with the macro #[derive(EguiInspect)]. If every underlying types implements EguiInspect, then you will be able to inspect it.

This is a side project, at a very early state, so the API might not be stable yet.

Example

img.png

You can inspect struct mutably and non-mutably. There is some customization per fields.

To implement this example, you just need to add egui_inspect as dependency to your project, and then, when drawing you ui with egui, you need to give your &Ui to the inspect function, no need for additional input . See example to see a complete integration with the eframe crate

Dependencies

~2MB
~42K SLoC