# ferroui_static_view_locator_build

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-static-view-locator-build/

**module** · [`ferroui-static-view-locator-build`](/docs/0.5.0/api/ferroui-static-view-locator-build/) · v0.5.0

```rust
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`.

```ignore
// build.rs
fn main() {
    ferroui_static_view_locator_build::StaticViewLocatorBuild::from_env()
        .view_model_namespace_prefixes(["crate::view_models"])
        .run();
}
```

```toml
[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`](/docs/0.5.0/api/ferroui-static-view-locator-build/struct-staticviewlocatorbuild/); the options of its attribute are the options of
`#[static_view_locator(..)]`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/StaticViewLocator/FerroUI.StaticViewLocator.Build/lib.rs#L1)

## Contents

- [`diagnostics`](/docs/0.5.0/api/ferroui-static-view-locator-build/diagnostics/) — module
- [`options`](/docs/0.5.0/api/ferroui-static-view-locator-build/options/) — module
- [`Diagnostic`](/docs/0.5.0/api/ferroui-static-view-locator-build/diagnostics/struct-diagnostic/) — struct
- [`Severity`](/docs/0.5.0/api/ferroui-static-view-locator-build/diagnostics/enum-severity/) — enum
- [`ResolutionMode`](/docs/0.5.0/api/ferroui-static-view-locator-build/enum-resolutionmode/) — enum
- [`GeneratorOptions`](/docs/0.5.0/api/ferroui-static-view-locator-build/options/struct-generatoroptions/) — struct
- [`ReplacementRule`](/docs/0.5.0/api/ferroui-static-view-locator-build/options/struct-replacementrule/) — struct
- [`OUTPUT_DIRECTORY`](/docs/0.5.0/api/ferroui-static-view-locator-build/constant-output_directory/) — constant
- [`GeneratedFile`](/docs/0.5.0/api/ferroui-static-view-locator-build/struct-generatedfile/) — struct
- [`Outcome`](/docs/0.5.0/api/ferroui-static-view-locator-build/struct-outcome/) — struct
- [`StaticViewLocatorBuild`](/docs/0.5.0/api/ferroui-static-view-locator-build/struct-staticviewlocatorbuild/) — struct

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
