Trait NativeUi

Source
pub trait NativeUi<UI> {
    // Required method
    fn build_ui(inital_state: Self) -> Result<UI, NwgError>;
}
Expand description

A structure that implements this trait is considered a GUI structure. The structure will hold GUI components and possibly user data.

The goal of NativeUi and PartialUi is to provide a common way to define NWG applications. Native-windows-derive can automatically implement this trait.

For an example on how to implement this trait, see the Small application layout section in the NWG documentation.

Required Methods§

Source

fn build_ui(inital_state: Self) -> Result<UI, NwgError>

A constructor for the structure. It should initialize the GUI components and bind GUI events.

Parameters:

  • inital_state: should contain the initial user data. NativeUi assumes this data will be wrapped in another type (UI).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§