DVUI

get

Used internally to get the dvui_app if it's defined

Source

Implementation

#
pub fn get() ?App {
    const root = @import("root");
    // return error instead of failing compile to allow for reference in tests without dvui_app defined
    if (!@hasDecl(root, "dvui_app")) return null;

    if (!@hasDecl(root, "main")) {
        @compileError(
            \\Using the App interface requires using the App main function
            \\
            \\Add the following line to your root file:
            \\pub const main = dvui.App.main;
        );
    }

    return root.dvui_app;
}