Inspect

Trait Inspect 

Source
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 implements Inspect too.

Required Methods§

Source

fn properties(&self) -> Vec<PropertyInfo<'_>>

Returns information about “public” properties.

Implementations on Foreign Types§

Source§

impl Inspect for f32

Source§

impl Inspect for f64

Source§

impl Inspect for i8

Source§

impl Inspect for i16

Source§

impl Inspect for i32

Source§

impl Inspect for i64

Source§

impl Inspect for u8

Source§

impl Inspect for u16

Source§

impl Inspect for u32

Source§

impl Inspect for u64

Source§

impl<T: Inspect> Inspect for Option<T>

Source§

impl<T: Inspect> Inspect for Box<T>

Implementors§

Source§

impl Inspect for ErasedHandle

Source§

impl<T: 'static> Inspect for Handle<T>