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