#inspect #egui #ui #automatic #struct #edit #preview

egui_inspect

Easily creating UI to edit and preview data

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

#658 in GUI

38 downloads per month

MIT license

12KB
202 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. There is no possibilities to override field's name yet

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

~5MB
~109K SLoC