# ferro_class_info

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/macro-ferro_class_info/

**macro** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
macro_rules! ferro_class_info
```

Declares the facts about a class that untyped code (markup, untyped
bindings) needs and cannot derive: its default constructor, the
interface handles its handle converts to and its markup metadata. Every
part is optional; the parts may be written in any order.

```ignore
ferro_class!(SolidColorBrush: Brush);
ferro_class_info!(SolidColorBrush {
    new: SolidColorBrush::new,
    interfaces: [Rc<dyn IBrush>],
});

ferro_class!(Panel: Control);
ferro_class_info!(Panel {
    new: Panel::new,
    markup: {
        content: Children,
        properties: [
            Children: Rc<Controls> { get: Panel::children },
        ],
    },
});
```

* `new` is a function without parameters that returns the handle of a new
  instance. It implements [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/) for the class, the
  static path to the constructor, and becomes
  `TypeInfo::default_constructor` with the tables of types (the feature
  `type-tables`; see `TypeInfo::with_constructor`).
* `interfaces` lists the handle types `I` that `Ref<Class>` converts to
  with `Into<I>`, or, as `I => function`, with the given
  `fn(Ref<Class>) -> I` (for an interface of another crate, for which
  the conversion trait cannot be implemented). They are registered with the untyped value conversions
  when the class is initialised, for the class and every class deriving
  from it (a more derived class that lists the same interface takes
  precedence for its own instances), and are listed by
  `TypeInfo::interfaces`.
* `markup` states what markup needs beyond the registered properties of
  the class, which need no declaration: the content property, plain
  (non-registered) properties and collections, constructors with
  arguments, methods, static values, events and attributes. The parts are
  the ones of `ferro_markup_type!` (without
  `handles`, `this` and `base`, which follow from the class); instance
  members are called with `&Ref<Class>`, so `Class::method` paths work as
  callables. It becomes `TypeInfo::markup`: constant data that costs
  nothing until it is read.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/type_system.rs#L1586)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
