FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ferroui_static_view_locator_build

    module · ferroui-static-view-locator-build · v0.5.0

    module ferroui_static_view_locator_build
    

    ferroui-static-view-locator-build

    The generator of ferroui-static-view-locator, run by the build script of a crate that declares view locators: a port of the source generator of StaticViewLocator (https://github.com/wieslawsoltes/StaticViewLocator, StaticViewLocatorGenerator). The plan, the mapping of every feature and the deviations are in docs/porting/static-view-locator.md.

    // build.rs
    fn main() {
        ferroui_static_view_locator_build::StaticViewLocatorBuild::from_env()
            .view_model_namespace_prefixes(["crate::view_models"])
            .run();
    }
    
    [build-dependencies]
    ferroui-static-view-locator-build = "0.4"
    

    What a run does

    1. Reads the .xamlmeta models of the dependencies (DEP_<LINKS>_XAMLMETA): the base classes of the views (UserControl, Window and the classes derived from them in other crates) and, with include_referenced_crates, their view models.
    2. Scans the sources of the crate with the scanner of the framework (ferroui-build-scan): the classes, their base classes and constructors, the paths of the modules.
    3. Reads the items of the sources: the types, the impl blocks, the visibility of the modules and the structs with #[static_view_locator].
    4. For each locator, maps its view models to their views and writes $OUT_DIR/static_view_locator/<name>.rs, which #[static_view_locator] includes.
    5. Prints the diagnostics (an error fails the build) and cargo::rerun-if-changed for every file it read.

    The options of the reference's MSBuild properties are the setters of StaticViewLocatorBuild; the options of its attribute are the options of #[static_view_locator(..)].

    View source

    Contents

    Availability

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