luaur-bytecode 0.1.0

Luau bytecode format and builder (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::records::bc_function::BcFunction;
use crate::records::bytecode_builder::BytecodeBuilder;
use crate::records::bytecode_graph_serializer::BytecodeGraphSerializer;

impl BytecodeGraphSerializer<'_> {
    pub fn bytecode_graph_serializer_bytecode_graph_serializer(
        bcb: &mut BytecodeBuilder,
        func: &mut BcFunction,
    ) -> Self {
        // SAFETY: Mirror the C++ constructor which stores references passed by the caller.
        // The returned serializer is parameterized to match the lifetime of those references.
        unsafe {
            core::mem::transmute::<BytecodeGraphSerializer<'_>, BytecodeGraphSerializer<'_>>(
                BytecodeGraphSerializer::new(bcb, func),
            )
        }
    }
}