pub trait Inspect {
// Required method
fn properties(&self) -> Vec<PropertyInfo<'_>>;
}
Expand description
A trait that allows you to “look inside” an object that implements it. It is used for lightweight runtime read-only reflection. The most common use case for it is various editors.
It is not advised to manually implement this trait. You should use #[derive(Inspect)]
whenever
possible.
§#[derive(Inspect)]
The proc macro reduces amount of boilerplate code to the minimum and significantly reduces a change of error.
§Supported attributes
#[inspect(name = "new_field_name")]
- override field name.#[inspect(display_name = "Human-readable Name")]
- override display name.#[inspect(group = "Group Name")]
- override group name.#[inspect(expand)]
- extends the list of properties in case of composition, in other words it “flattens” and exposes the properties of an inner object. Useful when you have a structure that has some fields that are complex objects that implementsInspect
too.
Required Methods§
Sourcefn properties(&self) -> Vec<PropertyInfo<'_>>
fn properties(&self) -> Vec<PropertyInfo<'_>>
Returns information about “public” properties.