unity_asset_core/
lib.rs

1//! Unity Asset Core
2//!
3//! Core data structures and types for Unity asset parsing.
4//! This crate provides the fundamental building blocks that are shared
5//! across different Unity asset formats (YAML, binary, etc.).
6
7pub mod constants;
8pub mod document;
9pub mod dynamic_access;
10pub mod error;
11pub mod unity_class;
12pub mod unity_value;
13
14// Re-export main types
15pub use constants::*;
16pub use document::{DocumentFormat, UnityDocument};
17pub use dynamic_access::{DynamicAccess, DynamicValue};
18pub use error::{Result, UnityAssetError};
19pub use unity_class::{UnityClass, UnityClassRegistry};
20pub use unity_value::UnityValue;
21
22/// Get Unity class name from class ID
23pub fn get_class_name(class_id: i32) -> Option<String> {
24    GLOBAL_CLASS_ID_MAP.get_class_name(class_id)
25}
26
27/// Get Unity class name from class ID without allocating.
28pub fn get_class_name_str(class_id: i32) -> Option<&'static str> {
29    GLOBAL_CLASS_ID_MAP.get_class_name_str(class_id)
30}
31
32#[cfg(test)]
33mod tests {
34    use super::*;
35
36    #[test]
37    fn test_basic_functionality() {
38        // Basic functionality test.
39        let class = UnityClass::new(1, "GameObject".to_string(), "123".to_string());
40        assert_eq!(class.class_id, 1);
41        assert_eq!(class.class_name, "GameObject");
42    }
43}