Skip to main content

Crate ferroui_static_view_locator_build

Crate ferroui_static_view_locator_build 

Source
Expand description

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(..)].

Re-exports§

pub use diagnostics::Diagnostic;
pub use diagnostics::Severity;
pub use options::GeneratorOptions;
pub use options::ReplacementRule;

Modules§

diagnostics
The diagnostics of the generator (DiagnosticDescriptors of StaticViewLocatorGenerator.Adapters.cs).
options
The options of the generator for a crate (the MSBuild properties StaticViewLocator* of the reference, GeneratorOptions), set by the build script.

Structs§

GeneratedFile
A generated file.
Outcome
What a run did.
StaticViewLocatorBuild
The generator of the locators of a crate, run by its build script.

Enums§

ResolutionMode
The fallback precedence of the generated adapters (ViewResolutionMode).

Constants§

OUTPUT_DIRECTORY
The directory below OUT_DIR the generated files are written to; #[static_view_locator] includes them from there.