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/// Language ID wrapper used by localized/text-bearing formats.
21pub mod language_id;
22/// Packed KEY/BIF resource ID wrapper and helpers.
23pub mod resource_id;
24/// Case-insensitive `(resname, restype)` identifier abstraction.
25pub mod resource_identifier;
26/// Canonical resource type definitions and extension mapping.
27pub mod resource_type;
28/// Resource reference (`ResRef`) value type and validation errors.
29pub mod resref;
30/// TLK string-reference (`StrRef`) value type and conversion helpers.
31pub mod strref;
32/// Shared text encoding helpers for binary format parsers/writers.
33pub mod text;
34/// Validated 2DA table names and the known vanilla table set.
35pub mod twoda_name;
36
37/// Zero-allocation ASCII case-insensitive string ordering.
38pub use ascii::cmp_ascii_case_insensitive;
39/// Detects the most likely resource type for byte data.
40pub use detect::detect_resource_type;
41/// Language ID wrapper used for TLK and localized-string metadata.
42pub use language_id::LanguageId;
43/// Packed KEY/BIF resource identifier.
44pub use resource_id::{ResourceId, ResourceIdError};
45/// Canonical resource identifier type.
46pub use resource_identifier::ResourceIdentifier;
47/// Resource type enum.
48pub use resource_type::{ResourceType, ResourceTypeCode};
49/// Fixed-length resource reference type used in KotOR binary formats.
50pub use resref::{ResRef, ResRefError, MAX_RESREF_LEN};
51/// TLK string-reference wrapper used by cross-format structures.
52pub use strref::{StrRef, StrRefError, INVALID_STRREF_RAW};
53/// Decodes bytes using a supported KotOR text encoding.
54pub use text::decode_text;
55/// Decodes bytes using strict lossless behavior for supported encodings.
56pub use text::decode_text_strict;
57/// Encodes text using a supported KotOR text encoding with strict lossless checks.
58pub use text::encode_text;
59/// Resolves a KotOR language ID to its configured text encoding.
60pub use text::text_encoding_for_language;
61/// Error returned when strict decoding encounters malformed input bytes.
62pub use text::DecodeTextError;
63/// Error returned when strict encoding cannot represent input text.
64pub use text::EncodeTextError;
65/// Error returned when a language ID does not map to a supported encoding.
66pub use text::LanguageEncodingError;
67/// Supported text encodings used by KotOR formats.
68pub use text::TextEncoding;
69/// Compile-time-validated `TwoDaName` constants for vanilla K1 2DAs.
70pub use twoda_name::tables;
71/// Validated 2DA table name.
72pub use twoda_name::TwoDaName;