How mlua-rs/mlua works
Main Components
a) Core Components:
• Lua Runtime Integration Layer
• Rust API Layer
• Type Conversion System
• Memory Management System
• Error Handling System
• Serialization System (optional feature)
• Async Support System (optional feature)
b) Supporting Components:
• Build System
• Module System
• Testing Framework
• Benchmarking System
┌─────────────────────────────────────────────────────────────┐
• Application Layer │
• ┤
• mlua API Layer │
• ┬──────────────┬──────────────────────────────┤
• Rust Types │ Lua Types │ Feature Modules │
• Conversion │ Management │ ┌────────┐ ┌──────────────┐ │
• System │ System │ │ Async │ │Serialization │ │
• Support │ │ (serde) │ │
• ┴──────────────┤ └────────┘ └──────────────┘ │
• Safety & Memory Management Layer │
• ┤
• Lua Runtime Integration │
• ┬──────────────┬───────────────┬───────────────┤
• Lua 5.4 │ Lua 5.3 │ Lua 5.2 │ Lua 5.1 │
• Support │ Support │ Support │ Support │
• ┼──────────────┼───────────────┼───────────────┤
• LuaJIT │ Luau │ Module │ Vendored │
• Support │ Support │ Support │ Mode │
• ┴──────────────┴───────────────┴───────────────┘
Implementation Details
• Type conversion paths between Rust and Lua
• Memory management flow
• Error handling and propagation
• Async runtime integration points
• Serialization pathways
• UserData implementation paths
Notes
• Version compatibility matrix
• Feature flag dependencies
• Safety boundaries
• Public API entry points
• Multiple Lua version support
• Safety-first design
• Flexible feature system
• Async capabilities
• Serialization support
• Module system support