Skip to main content

Component

Trait Component 

Source
pub trait Component {
    const NAME: &'static str;
    const DOC: &'static str = "";
    const DISPLAY_NAME: &'static str = "";
    const ICON: &'static str = "";
    const CATEGORY: &'static str = "";
    const DESIGN_SIZE: (f32, f32) = _;
    const TOOLBOX: bool = true;
    const PROPS: &'static [Prop] = _;

    // Required method
    fn build(props: &Props) -> Widget;
}
Expand description

A custom component — implemented by the code yog build generates from a <Component> .yui (see the module docs).

Required Associated Constants§

Source

const NAME: &'static str

The .yui element name (<StatBar …/>), PascalCase.

Provided Associated Constants§

Source

const DOC: &'static str = ""

Its description: the designer’s toolbox tooltip and property grid header. Texts here and below may be @Set.key resource references.

Source

const DISPLAY_NAME: &'static str = ""

The designer’s toolbox label (empty: NAME).

Source

const ICON: &'static str = ""

The toolbox icon, a Yog image source (item:…, sprite:…, mod:…) or @Icons.x; empty: a generic glyph.

Source

const CATEGORY: &'static str = ""

The toolbox category (empty: “ Components”).

Source

const DESIGN_SIZE: (f32, f32) = _

Its size on the designer’s canvas and when dropped (0: unset).

Source

const TOOLBOX: bool = true

Whether the toolbox offers it (false: internal to the mod’s own markup).

Source

const PROPS: &'static [Prop] = _

Required Methods§

Source

fn build(props: &Props) -> Widget

The widget tree for these properties. Common attributes (position, size, bg, on_click, …) are applied to the result by the caller.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§