Skip to main content

Crate bern_target_api

Crate bern_target_api 

Source
Expand description

The interface every UI target module implements.

A target describes itself and its capabilities, checks the shared IR, generates code and resources, and returns a build plan that the build driver executes. The compiler core only talks to this interface; it never imports a concrete target, and disabling one target leaves the others buildable.

Modules§

brand_assets
tvOS application icons. A tvOS app shows a layered icon that tilts under the focus, made of image stacks in a .brandassets folder of an asset catalog: the home screen icon at 400 × 240 points, the App Store icon at 1280 × 768, and the Top Shelf images shown when the app sits in the top row. A declared .brandassets folder ships as it is; from a square PNG (or the Bern logo) this module draws one: the icon on a back layer of its own background color, so the art floats over its ground when the icon tilts.
feature
Names of IR features a target lists in TargetDescriptor::features.
glue
Rust source for generated glue crates.
icon
Application icons. Without [app].icon every target uses the Bern logo; with it, the declared square PNG. [app.icon] can also give a platform its own icon: another square PNG, or the icon in the platform’s own form (an .icns file, an .ico file, an .appiconset folder, an Icon Composer .icon folder for macOS and iOS, a tvOS .brandassets folder, an Android res folder, an icon theme folder, a folder of page icons), which is shipped as it is. The platform containers (.ico on Windows, .icns on macOS) hold PNG images as they are, so nothing here decodes or scales pixels: the logo ships pre-rendered at every size the platforms ask for, and a declared PNG is used at its own size. Only tvOS’s layered icon is drawn from the square one, in crate::brand_assets.
icon_set
The Bern icon set: icon names in SF Symbols naming. The Apple targets draw every SF Symbol; the other targets map each name to one of their platform’s own icons, and every one of them draws at least the names listed here. A name a target cannot draw fails its check at the element, so no target shows a placeholder in its place.
names
Identifiers generators derive from Bern’s snake_case names. Each target escapes the results that are keywords of its own language.
script
Build-time selection and shared sources of the JavaScript host.
skill
The agent skill a build ships beside its command line: a SKILL.md that tells an agent how to reach the running application and lists every command, query, state field and UI action of this build, from the same catalog the command line and the MCP server derive theirs from.
style
Style overrides of one platform: the rules of style! that apply to a control kind and variant, merged for a target to draw.
svg
Shared animated SVG assets and runtime templates for all presenters.
texts
Texts every native runtime shows itself, the per-language tables of runtimes that fill Bern’s named placeholders, and the conversion of those placeholders to a platform’s positional format specifiers.

Structs§

AndroidOptions
Android capabilities needed by an application’s Rust engine, which cannot be inferred from its UI. Multicast also enables network access.
BuildContext
Paths and packages a target needs to plan its build.
BuildPlan
Diagnostic
A diagnostic pointing back to the developer’s declaration.
FeatureReport
A feature contract report for one platform: the result of every feature in every applicable size, and the diagnostics they raise.
GeneratedFile
MediaSupport
The media backend and video presenter a target assembles for Video. The two are versioned separately from the target and from each other.
ModuleBuild
The crates of one application module, for the generated glue.
Registry
Explicit registry of target modules, assembled by the build host.
Signing
How packages are signed, from the environment of bern package. Certificates stay with the person or the CI service that builds; none of this goes into Bern.toml.
StyleSupport
The style effects a target shows for one control kind: outside any state, and in each state.
TargetConfig
Target settings from [targets.<name>] in Bern.toml.
TargetDescriptor
WebExtension
An application-owned browser adapter. Its index.js exports a setup function.
WindowCapabilities
How a target can present Window declarations.

Enums§

BuildStep
One step the build driver executes for a target.
ColorSource
Where a target’s colors come from.
Framework
Where the Bern crates come from: the source of the project’s own bern dependency. Generated crates take every Bern crate from it, so the application and the code generated around it share one copy of each.
Run
How bern run starts a built application.
Severity
SimulatedSystem
The system a simulator runs, as its runtimes name it.

Constants§

WINDOWS_FRONTENDS
The Windows front ends: WinUI 3 on the Windows App Runtime, and the system XAML through XAML Islands, which every Windows 10 and 11 has.

Traits§

Target
A UI target module.

Functions§

archive
A step that archives dir, with dir itself as the top folder, into stem plus the extension the build machine’s own tools make: .zip on macOS (ditto) and Windows (tar), .tar.gz on Linux (tar).
check_common
Check the parts of the IR every target must agree on: IR version, supported components and window presentation requirements.
default_ui
Default UI technology per platform.
dist_dir
Where packages go: target/bern/dist/ of the workspace.
feature_report
Evaluate every feature contract for platform: exemptions apply only to their platform; missing and unproven features are errors (B201, B203), manual guarantees warnings (B206) and exemptions notes (B205).
files_below
Every file below dir, as (path, path relative to dir), sorted.
package_architecture
The build machine’s architecture as packages name it: arm64 or x64 (x86_64 on macOS, where that is the usual name).
toml_string
A TOML basic string.
uses_text_formats
Whether the application writes numbers, dates or durations in its texts, or shows enum fields in labels: what feature::TEXT_FORMATS names.