Skip to main content

luaur_analysis/functions/
get_mutable_txn_log.rs

1//! Node: `cxx:Function:Luau.Analysis:Analysis/include/Luau/TxnLog.h:51:get_mutable`
2//! Source: `Analysis/include/Luau/TxnLog.h:51-56` (hand-ported)
3
4use crate::functions::get_mutable_type::get_mutable_type_id;
5use crate::records::pending_type::PendingType;
6use crate::records::r#type::Type;
7use crate::type_aliases::type_variant::TypeVariantMember;
8
9/// C++ `template<typename T> T* getMutable(PendingType* pending)`.
10pub unsafe fn get_mutable_pending_type<T: TypeVariantMember + 'static>(
11    pending: *mut PendingType,
12) -> *mut T {
13    // We use getMutable here because this state is intended to be mutated freely.
14    get_mutable_type_id::<T>(&(*pending).pending as *const Type)
15}
16
17#[allow(unused_imports)]
18pub use get_mutable_pending_type as get_mutable;