Skip to main content

luaur_bytecode/methods/
bytecode_graph_serializer_bytecode_graph_serializer.rs

1use crate::records::bc_function::BcFunction;
2use crate::records::bytecode_builder::BytecodeBuilder;
3use crate::records::bytecode_graph_serializer::BytecodeGraphSerializer;
4
5impl BytecodeGraphSerializer<'_> {
6    pub fn bytecode_graph_serializer_bytecode_graph_serializer(
7        bcb: &mut BytecodeBuilder,
8        func: &mut BcFunction,
9    ) -> Self {
10        // SAFETY: Mirror the C++ constructor which stores references passed by the caller.
11        // The returned serializer is parameterized to match the lifetime of those references.
12        unsafe {
13            core::mem::transmute::<BytecodeGraphSerializer<'_>, BytecodeGraphSerializer<'_>>(
14                BytecodeGraphSerializer::new(bcb, func),
15            )
16        }
17    }
18}