Trait bevy_inspector_egui::Inspectable [−][src]
pub trait Inspectable { type Attributes: Default + Clone; fn ui(
&mut self,
ui: &mut Ui,
options: Self::Attributes,
context: &Context<'_>
) -> bool; fn ui_raw(&mut self, ui: &mut Ui, options: Self::Attributes) { ... } fn setup(app: &mut AppBuilder) { ... } }
Expand description
This trait describes how a struct should be displayed. It can be derived for structs and enums, see the crate-level docs for how to do that.
Default attributes
- ignore: hides the field in the inspector
- label: provides a label instead of using the field name
- read_only: disables the UI
- collapse: wraps the ui in an [
egui::CollapsingHeader
]. - default: only for enums, specifies the default value when selecting a new variant
- wrapper: wrap field UI in a custom function. Demo in the rust_types example.
Associated Types
type Attributes: Default + Clone
type Attributes: Default + Clone
The Attributes
associated type specifies what attributes can be passed to a field.
See the following snippet for an example:
struct MyCustomType; struct MyWidgetAttributes { a: f32, b: Option<String> } impl Inspectable for MyCustomType { type Attributes = MyWidgetAttributes; fn ui(&mut self, _: &mut egui::Ui, options: MyWidgetAttributes, context: &Context) -> bool { println!("a = {}, b = {:?}", options.a, options.b); false } } // ... #[derive(Inspectable)] struct InspectorData { #[inspectable(a = 10.0, b = None)] value: MyCustomType, }
Required methods
fn ui(
&mut self,
ui: &mut Ui,
options: Self::Attributes,
context: &Context<'_>
) -> bool
fn ui(
&mut self,
ui: &mut Ui,
options: Self::Attributes,
context: &Context<'_>
) -> bool
This methods is responsible for building the egui ui. Returns whether any data was modified.
Provided methods
fn ui_raw(&mut self, ui: &mut Ui, options: Self::Attributes)
fn ui_raw(&mut self, ui: &mut Ui, options: Self::Attributes)
Displays the value without any context. Useful for usage outside of the plugins, where
there is no access to the world or EguiContext
.
Implementations on Foreign Types
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = <Transform as Inspectable>::Attributes
type Attributes = ()
type Attributes = ()
type Attributes = ColorAttributes
type Attributes = <Color as Inspectable>::Attributes
type Attributes = <Color as Inspectable>::Attributes
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = T::Attributes
type Attributes = <T as Inspectable>::Attributes
type Attributes = <T as Inspectable>::Attributes
type Attributes = ()
type Attributes = (<A as Inspectable>::Attributes,)
type Attributes = (<A as Inspectable>::Attributes, <B as Inspectable>::Attributes)
impl<A: Inspectable + 'static, B: Inspectable + 'static, C: Inspectable + 'static> Inspectable for (A, B, C)
impl<A: Inspectable + 'static, B: Inspectable + 'static, C: Inspectable + 'static> Inspectable for (A, B, C)
type Attributes = (<A as Inspectable>::Attributes, <B as Inspectable>::Attributes, <C as Inspectable>::Attributes)
impl<A: Inspectable + 'static, B: Inspectable + 'static, C: Inspectable + 'static, D: Inspectable + 'static> Inspectable for (A, B, C, D)
impl<A: Inspectable + 'static, B: Inspectable + 'static, C: Inspectable + 'static, D: Inspectable + 'static> Inspectable for (A, B, C, D)
type Attributes = (<A as Inspectable>::Attributes, <B as Inspectable>::Attributes, <C as Inspectable>::Attributes, <D as Inspectable>::Attributes)
type Attributes = NumberAttributes<i8>
type Attributes = NumberAttributes<i16>
type Attributes = NumberAttributes<i32>
type Attributes = NumberAttributes<i64>
type Attributes = NumberAttributes<isize>
type Attributes = NumberAttributes<u8>
type Attributes = NumberAttributes<u16>
type Attributes = NumberAttributes<u32>
type Attributes = NumberAttributes<u64>
type Attributes = NumberAttributes<usize>
type Attributes = NumberAttributes<f32>
type Attributes = NumberAttributes<f64>
type Attributes = StringAttributes
type Attributes = ()
type Attributes = ()
type Attributes = T::Attributes
type Attributes = T::Attributes
type Attributes = OptionAttributes<T>
type Attributes = ()
type Attributes = QuatAttributes
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = ()
type Attributes = T::Attributes
type Attributes = ()
type Attributes = Vec2dAttributes
type Attributes = NumberAttributes<Vec3>
type Attributes = NumberAttributes<Vec4>
type Attributes = NumberAttributes<UVec4>
type Attributes = NumberAttributes<IVec4>
type Attributes = NumberAttributes<DVec4>
type Attributes = ()
type Attributes = T::Attributes
type Attributes = TextureAttributes
type Attributes = ()
type Attributes = WorldInspectorParams
type Attributes = EntityAttributes
Implementors
impl<'w, Q, F> Inspectable for InspectorQuery<Q, F> where
Q: WorldQuery,
F: WorldQuery,
F::Fetch: FilterFetch,
<<Q as WorldQuery>::Fetch as Fetch<'static>>::Item: Inspectable,
impl<'w, Q, F> Inspectable for InspectorQuerySingle<Q, F> where
Q: WorldQuery,
F: WorldQuery,
F::Fetch: FilterFetch,
<<Q as WorldQuery>::Fetch as Fetch<'static>>::Item: Inspectable,