# StaticViewLocatorBuild

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

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

```rust
struct StaticViewLocatorBuild
```

The generator of the locators of a crate, run by its build script.

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

## Members

- [`from_env`](#function-from_env)
- [`new`](#function-new)
- [`crate_name`](#function-crate_name)
- [`source_root`](#function-source_root)
- [`view_model_namespace_prefixes`](#function-view_model_namespace_prefixes)
- [`include_internal_view_models`](#function-include_internal_view_models)
- [`include_referenced_crates`](#function-include_referenced_crates)
- [`additional_view_base_types`](#function-additional_view_base_types)
- [`namespace_replacement_rules`](#function-namespace_replacement_rules)
- [`type_name_replacement_rules`](#function-type_name_replacement_rules)
- [`strip_generic_arity_from_view_name`](#function-strip_generic_arity_from_view_name)
- [`interface_prefixes_to_strip`](#function-interface_prefixes_to_strip)
- [`property`](#function-property)
- [`options`](#function-options)
- [`reactiveui_available`](#function-reactiveui_available)
- [`write_files`](#function-write_files)
- [`run`](#function-run)
- [`execute`](#function-execute)

<a id="function-from_env"></a>

### from_env

```rust
fn from_env() -> Self
```

The generator of the crate whose build script is running: `CARGO_MANIFEST_DIR`, `OUT_DIR`,
`CARGO_PKG_NAME` (the name of the library when the crate states another one cannot be
read; state it with `crate_name`), the `.xamlmeta` of every direct
dependency, and whether ferroui-static-view-locator has the feature `reactiveui`
(`DEP_FERROUI_STATIC_VIEW_LOCATOR_REACTIVEUI`).
## Panics
Panics outside a build script (a variable Cargo sets is missing).

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

<a id="function-new"></a>

### new

```rust
fn new(manifest_dir: PathBuf, out_dir: PathBuf, package_name: &str, dependencies: Vec<PathBuf>) -> Self
```

The generator of the package `package_name` in `manifest_dir`, writing below `out_dir`,
with the `.xamlmeta` files of its direct dependencies.

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

<a id="function-crate_name"></a>

### crate_name

```rust
fn crate_name(self: Self, name: &str) -> Self
```

The name of the crate as Rust paths spell it, when the library has another name than the
package.

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

<a id="function-source_root"></a>

### source_root

```rust
fn source_root(self: Self, file: &str) -> Self
```

The root file of the sources, relative to the crate directory. Without the call:
`src/lib.rs`, `lib.rs`, else `src/main.rs`.

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

<a id="function-view_model_namespace_prefixes"></a>

### view_model_namespace_prefixes

```rust
fn view_model_namespace_prefixes<I: IntoIterator<Item = S>, S: AsRef<str>>(self: Self, prefixes: I) -> Self
```

The module paths view models are taken from (`StaticViewLocatorViewModelNamespacePrefixes`).

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

<a id="function-include_internal_view_models"></a>

### include_internal_view_models

```rust
fn include_internal_view_models(self: Self, include: bool) -> Self
```

`StaticViewLocatorIncludeInternalViewModels`; without an effect (see
`GeneratorOptions::include_internal_view_models`).

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

<a id="function-include_referenced_crates"></a>

### include_referenced_crates

```rust
fn include_referenced_crates(self: Self, include: bool) -> Self
```

Whether the view models of the crates the crate depends on are taken
(`StaticViewLocatorIncludeReferencedAssemblies`).

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

<a id="function-additional_view_base_types"></a>

### additional_view_base_types

```rust
fn additional_view_base_types<I: IntoIterator<Item = S>, S: AsRef<str>>(self: Self, types: I) -> Self
```

More view base types (`StaticViewLocatorAdditionalViewBaseTypes`).

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

<a id="function-namespace_replacement_rules"></a>

### namespace_replacement_rules

```rust
fn namespace_replacement_rules<I: IntoIterator<Item = (F, T)>, F: AsRef<str>, T: AsRef<str>>(self: Self, rules: I) -> Self
```

The namespace rules applied before the defaults (`StaticViewLocatorNamespaceReplacementRules`).

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

<a id="function-type_name_replacement_rules"></a>

### type_name_replacement_rules

```rust
fn type_name_replacement_rules<I: IntoIterator<Item = (F, T)>, F: AsRef<str>, T: AsRef<str>>(self: Self, rules: I) -> Self
```

The type name rules applied before the default (`StaticViewLocatorTypeNameReplacementRules`).

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

<a id="function-strip_generic_arity_from_view_name"></a>

### strip_generic_arity_from_view_name

```rust
fn strip_generic_arity_from_view_name(self: Self, strip: bool) -> Self
```

`StaticViewLocatorStripGenericArityFromViewName` (default `true`).

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

<a id="function-interface_prefixes_to_strip"></a>

### interface_prefixes_to_strip

```rust
fn interface_prefixes_to_strip<I: IntoIterator<Item = S>, S: AsRef<str>>(self: Self, prefixes: I) -> Self
```

The prefixes removed from the names of trait view models (`StaticViewLocatorInterfacePrefixesToStrip`).

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

<a id="function-property"></a>

### property

```rust
fn property(self: Self, name: &str, value: &str) -> Self
```

Sets an option from its text, as an MSBuild property is read
(`GeneratorOptions::set`): `property("type_name_replacement_rules", "ViewModel=View,Vm=Page")`.

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

<a id="function-options"></a>

### options

```rust
fn options(self: Self, options: GeneratorOptions) -> Self
```

All the options at once.

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

<a id="function-reactiveui_available"></a>

### reactiveui_available

```rust
fn reactiveui_available(self: Self, available: bool) -> Self
```

Whether ferroui-static-view-locator has the feature `reactiveui`; `from_env`
reads it from Cargo.

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

<a id="function-write_files"></a>

### write_files

```rust
fn write_files(self: Self, write: bool) -> Self
```

Whether `execute` writes the generated files (default `true`); without, the
files are only in the `Outcome`.

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

<a id="function-run"></a>

### run

```rust
fn run(self: Self)
```

Runs the generator and prints its lines and diagnostics for Cargo. On an error the process
exits with a failure.

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

<a id="function-execute"></a>

### execute

```rust
fn execute(self: Self) -> Outcome
```

Runs the generator and returns what `run` prints, with the generated files.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`

## Availability

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