FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ClassDefaults

    trait · ferroui-base · v0.5.0

    trait ClassDefaults
    

    What a type declares when it declares nothing: no default constructor, no interface casts, no properties and an empty static constructor.

    The class macros read the declarations of a type through the names below. A type that declares one of them does so with an inherent item of the same name (written by hand for static_constructor, generated by ferro_properties! and ferro_class_info! for the others), which takes precedence over this trait; every other type falls back to it.

    View source

    Members

    static_constructor

    fn static_constructor()
    

    The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides).

    A class declares it as an inherent function in the module of its ferro_class!:

    impl Border {
        fn static_constructor() {
            Self::affects_render::<Border>(&[Self::background_property().as_property()]);
        }
    }
    

    It is never called by hand: the class initialisation calls it. Use Border::TYPE.ensure_class_init() to force the initialisation.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.