unityrs_export/lib.rs
1//! Exports beside the textures, for the batch engine (`docs/DESIGN.md`
2//! section 4's `unityrs-export` row): the `sprites` kind (E17, gate row
3//! X2), the NGUI atlas cutter (`docs/plans/extract.md` E21 to E26, gate row
4//! X5) and the JSON writer it writes with.
5//!
6//! - [`ngui::cut`]: one input's view to its Sprites' PNGs, its atlases'
7//! crops (PNG), each atlas's JSON, the skips with their closed reasons and
8//! the sheet-to-atlas units, as `docs/BATCH_SPEC.md` sections 3, 4.3, 4.4
9//! and 5 say, the textures `outputs.textures` selects among them.
10//! - [`ngui::winners`]: 4.5's steps 1 to 3 over the cuts of several inputs.
11//! - [`keys`]: key templates, `safe()` and the key rules, which the
12//! engine's validation checks a spec's templates and keys with.
13//! - [`simple`]: metered single-object `TextAsset`, Font, MonoBehaviour JSON
14//! (or raw fallback), and Tier X `VideoClip` resource payloads.
15//! - [`shader::export`]: Tier A Shader text with metered platform-blob decoding.
16//! - [`extractor`]: UnityPy's extraction order and names, typed reports,
17//! and corrected `GameObject` crawls, through a caller's metered sink.
18//! - [`pyjson`]: `CPython` 3.11's `json.dumps(value, indent=2)` of a typetree
19//! value, byte for byte (E24).
20//!
21//! It is written from the specification, not ported from the Python
22//! references (`tools/parity/ngui_cutter.py`, `tools/parity/sprites_kind.py`),
23//! which record the fixtures it is tested against (`unityrs-testkit`'s
24//! `tests/fixtures/ngui.json` and `tests/fixtures/sprites.json`). The
25//! sprites kind's files port UnityPy 1.25.2's Sprite rules (MIT), as do
26//! the reads' names a `Sprite` or a `Texture2D` cannot be given
27//! (`ngui::read::SETTERLESS`), each saying so in its header, with the
28//! notice in the crate's `LICENSE-UNITYPY`.
29//! The cutter checks `max_attempt_evictions` itself, after each Environment
30//! call (registration's included), and `max_export_work` through the
31//! engine's [`ngui::Hooks::export_work`], as it does the stop, the decode
32//! work and the memory budgets; their values, the spool and 4.6's prefix
33//! conflicts are the engine's.
34#![forbid(unsafe_code)]
35// No panics on an input's contents (docs/plans/core.md section 3.15), as in
36// the core and the decoders. Tests may opt out.
37#![cfg_attr(
38 not(test),
39 deny(
40 clippy::unwrap_used,
41 clippy::expect_used,
42 clippy::panic,
43 clippy::todo,
44 clippy::unimplemented,
45 clippy::unreachable,
46 clippy::indexing_slicing
47 )
48)]
49
50pub mod audio;
51pub use unityrs_audio::VorbisHeaders;
52pub mod extractor;
53#[cfg(feature = "gltf")]
54pub mod gltf;
55pub mod ngui;
56pub mod pyjson;
57mod pyjson_numbers;
58pub mod shader;
59pub mod simple;
60#[cfg(feature = "test-counters")]
61pub mod testing;
62
63/// Key templates, `safe()` and the key rules (`docs/BATCH_SPEC.md` 2.1 to
64/// 2.3), the engine's and the cutter's one copy: validation checks a spec's
65/// templates and literal keys through it ([`keys::check_template`],
66/// [`keys::check_prefixed`]), and an attempt expands and checks its keys.
67pub use ngui::keys;