Skip to main content

Module abi

Module abi 

Source
Expand description

Host ABI data generated with Askama templates (packages/core/codegen/templates/): the Core and runtime scene ABIs, the word-table field specs, and the golden XXH64 vectors. Every file lands next to the static runtime it plugs into (packages/core/host-{cxx,swift,java,dart,ts}).

Inputs are borrowed: nativeview-abi’s const AbiFileDescriptors and the &'static TableDescs of whichever table crate the caller links (nativeview-cli passes nativeview_tables::CORE_TABLE_DESCS), so this crate never depends on a table crate. Templates are checked by rustc at compile time.

Re-exports§

pub use flat_op::generate_flat_op_codec_files;
pub use flat_op::generate_flat_op_codec_files_for_module;
pub use shared_values::generate_shared_value_sets_c;
pub use shared_values::generate_shared_value_sets_dart;
pub use shared_values::generate_shared_value_sets_java;
pub use shared_values::generate_shared_value_sets_swift;
pub use shared_values::generate_shared_value_sets_ts;

Modules§

flat_op
Generic Askama view-model and emitter for flat 4-byte-aligned (u32-word) operation-stream codecs (nativeview_codec::FlatOpStreamDesc).
java_host
Java host files outside the core table set: the golden NV0V v2 event-batch test vector (nativeview_abi::EventBatchBuf::to_wire_bytes). Capability-module word tables are generated per-module into packages/modules/<cap>/android/.../generated/Nv<Mod>Tables.java.
jni_frame
The packed JNI scene frame: one long[] header + one ByteBuffer[] of slabs that libnv_android_shell fills per acquireScene and io.github.nativeview.host.SceneReader reads (one JNI crossing per frame). Both sides are generated from this one layout (NvJniFrame.java, nv_jni_frame.generated.hpp), so their indices cannot drift; the LAYOUT_HASH both carry lets the JNI build reject a stale Java half.
layout
ABI type spellings and the C layout of every record on 32-bit and 64-bit targets.
model
Borrowed view-models the ABI templates render: the Core ABI, the runtime ABI, the word tables, and the golden XXH64 vectors. No owned intermediate spec: every name, type, and doc string is a &'a str into the nativeview-abi descriptors.
policy
The one generic emitter of nv_policy! constants (nativeview_abi::policy) for every host language a policy’s consumers read, plus the symbol names each consumer must read (shared with the [INV:host-policy-single-source] read check, so emitter and guard never disagree).
scene_facts
Typed scene-fact accessors ([INV:scene-facts-registered]) for all five host SceneReaders, rendered from nativeview_abi::SceneFact::ALL: per language, the fact ids, the table resolver (exactly one entry per registered fact, matching stride and count, validated elements) and one typed accessor per fact. A fact added to the registry reaches every reader by regeneration. The same files carry nativeview_abi::CLOSE_REQUEST_KEYS (named constants + isCloseRequestKey), the one close-key list of every host ([INV:close-request-single-path]).
shared_values
Standalone cross-module shared value-set emitters (nativeview-media-fit’s ImageFit and ImageSampling, etc.) for C/C++, Swift, Java, Dart, and TypeScript.
spell
Per-language spellings of ABI types, names, and values, called from the Askama templates.
tables
The word-table view-model every host table mirror renders: per-table metadata (inheritance, EventSet word), per-field host specs (kind, Option encoding, wide value word, explicit bit, resource kind), and the named value sets, all validated once so every host constructor accepts them.
top_layer_vectors
Top-layer policy conformance vectors ([INV:top-layer-policy-conformance]): the pointer-down “hide popovers until” cases and the close-key probes, with the verdicts the Rust reference computed, rendered for the C++, Swift, Java, Dart and TS host suites. The caller (nativeview-cli) evaluates the reference (nativeview_layout::scene::top_layer_conformance) and passes plain data, so this crate stays layout-free.

Functions§

abi_model
The Core ABI model of the linked nativeview-abi.
generate_abi_files
Every Core ABI file (C, Swift constants, Java, Dart const + dart:ffi, TypeScript), the C runtime ABI header, and the five scene-fact readers.
generate_all_abi_files
Every generated host file: ABI, tables, and the golden XXH64 vectors.
generate_c_abi_header
nv_abi.generated.h: the merged C ABI header every C / C++ / Objective-C / Swift host imports.
generate_dart_module_table_file
Per-module Dart table mirror (nv_<stem>_tables.generated.dart) importing package:nativeview_host.
generate_hash_vector_files
The golden XXH64 vectors for every host runtime’s test suite.
generate_java_module_table_file
Per-module Java table mirror (<package>.Nv<Mod>Tables) living in the module’s Android leaf.
generate_module_c_abi_header
Renders a standalone capability-module C11 / C++20 ABI header from a #[derive(NvAbi)] AbiFileDescriptor, with cross-data-model NV_STATIC_ASSERT layout locks.
generate_module_java_abi_file
Renders a standalone capability-module Java ABI constants/enum class from a #[derive(NvAbi)] AbiFileDescriptor.
generate_module_table_header
The C11 / C++20 mirror of a capability module’s tables (module = canvas -> NV_CANVAS_TABLES_GENERATED_H, includes <nv/host/table_word.h> from nv::host_cxx). The caller links the module and passes its descriptors plus core_tables and shared_sets (for cross-check against core and cross-module WordEnum value sets), so this crate stays module-free.
generate_swift_module_table_file
Per-module Swift table mirror (Nv<Mod>Tables.generated.swift) living in the module’s own Swift target (import NativeViewHost, value sets nested under Values to avoid collisions).
generate_table_files
Field specs, keys, schema hashes, and named field values of tables for every host runtime.
generate_ts_module_table_file
Per-module TypeScript table mirror (nv_<stem>_tables.generated.ts) importing @nativeview/host.
render_c_runtime_abi
Renders the C runtime ABI header for an arbitrary validated RuntimeAbiModel.
render_dart_runtime_abi
Renders the Dart runtime ABI bindings for an arbitrary validated RuntimeAbiModel.
runtime_abi_model
The runtime ABI model on top of base (abi_model()).
validate_merged_shared_value_sets
Upfront cross-check of all registered cross-module shared value sets against core table value sets (rejects conflicting redefinitions or C constant collisions before any file is emitted).