rakata_core/lib.rs
1//! Core primitives used throughout the KotOR Rust workspace.
2//!
3//! This crate holds shared value types (`ResRef`, `ResourceType`, `ResourceId`)
4//! and core utilities (`fs`, `text`, `detect`) required by multiple higher-level crates.
5//!
6//! It is intentionally dependency-light, serving as the foundational layer for
7//! the workspace.
8
9#![warn(clippy::as_conversions)]
10#![forbid(unsafe_code)]
11#![deny(missing_docs)]
12#![deny(clippy::missing_errors_doc)]
13
14/// ASCII string utilities shared across KotOR crates.
15pub mod ascii;
16/// Binary signature and extension-based resource type detection.
17pub mod detect;
18/// Filesystem helpers shared across KotOR crates.
19pub mod fs;
20/// Which of the two games something belongs to.
21pub mod game;
22/// Language ID wrapper used by localized/text-bearing formats.
23pub mod language_id;
24/// Packed KEY/BIF resource ID wrapper and helpers.
25pub mod resource_id;
26/// Case-insensitive `(resname, restype)` identifier abstraction.
27pub mod resource_identifier;
28/// Canonical resource type definitions and extension mapping.
29pub mod resource_type;
30/// Resource reference (`ResRef`) value type and validation errors.
31pub mod resref;
32/// TLK string-reference (`StrRef`) value type and conversion helpers.
33pub mod strref;
34/// Shared text encoding helpers for binary format parsers/writers.
35pub mod text;
36/// Validated 2DA table names and the known vanilla table set.
37pub mod twoda_name;
38
39/// Zero-allocation ASCII case-insensitive string ordering.
40pub use ascii::cmp_ascii_case_insensitive;
41/// Detects the most likely resource type for byte data.
42pub use detect::detect_resource_type;
43/// Which of the two games something belongs to.
44pub use game::Game;
45/// Language ID wrapper used for TLK and localized-string metadata.
46pub use language_id::LanguageId;
47/// Packed KEY/BIF resource identifier.
48pub use resource_id::{ResourceId, ResourceIdError};
49/// Canonical resource identifier type.
50pub use resource_identifier::ResourceIdentifier;
51/// Resource type enum.
52pub use resource_type::{ResourceType, ResourceTypeCode};
53/// Fixed-length resource reference type used in KotOR binary formats.
54pub use resref::{ResRef, ResRefError, MAX_RESREF_LEN};
55/// TLK string-reference wrapper used by cross-format structures.
56pub use strref::{StrRef, StrRefError, INVALID_STRREF_RAW};
57/// Decodes bytes using a supported KotOR text encoding.
58pub use text::decode_text;
59/// Decodes bytes using strict lossless behavior for supported encodings.
60pub use text::decode_text_strict;
61/// Encodes text using a supported KotOR text encoding with strict lossless checks.
62pub use text::encode_text;
63/// Resolves a KotOR language ID to its configured text encoding.
64pub use text::text_encoding_for_language;
65/// Error returned when strict decoding encounters malformed input bytes.
66pub use text::DecodeTextError;
67/// Error returned when strict encoding cannot represent input text.
68pub use text::EncodeTextError;
69/// Error returned when a language ID does not map to a supported encoding.
70pub use text::LanguageEncodingError;
71/// Supported text encodings used by KotOR formats.
72pub use text::TextEncoding;
73/// Compile-time-validated `TwoDaName` constants for vanilla K1 2DAs.
74pub use twoda_name::tables;
75/// Validated 2DA table name.
76pub use twoda_name::TwoDaName;