Skip to main content

UserdataTypeRegistryAccess

Trait UserdataTypeRegistryAccess 

Source
pub trait UserdataTypeRegistryAccess: Sealed {
    // Required methods
    unsafe fn userdata_type<T: 'static>(
        &self,
    ) -> Option<UserdataTypeRegistration>;
    unsafe fn retire_userdata_type<T: 'static>(&self);
    unsafe fn register_userdata_type<T: 'static>(
        &self,
        metatable_index: i32,
    ) -> VmErrorResult<UserdataTypeRegistration>;
}
Expand description

Unstable registration capability for Rust values stored in VM userdata.

Registered types are available to VM-native callbacks and to higher-level embedding layers. Raw and tagged userdata remain independent of this registry.

§Safety

The thread must be live, stack indices must be valid, registrations must belong to the same VM, and callers must serialize registry mutation and keep referenced metatables rooted. Each registered metatable must identify exactly one Rust payload type and must not be reassigned to userdata with a different payload layout.

Required Methods§

Source

unsafe fn userdata_type<T: 'static>(&self) -> Option<UserdataTypeRegistration>

Source

unsafe fn retire_userdata_type<T: 'static>(&self)

Source

unsafe fn register_userdata_type<T: 'static>( &self, metatable_index: i32, ) -> VmErrorResult<UserdataTypeRegistration>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§