Struct rusty_spine::RendererObject
source · pub struct RendererObject<'a> { /* private fields */ }
Expand description
A wrapper around a user data void pointer found on a few Spine C structs.
The Spine C runtime sets this automatically to the attachment’s atlas region for region and mesh
attachments if using the default atlas attachment loader. In this case,
get_atlas_region
can be used to get the Rust struct.
The value can be set manually but will panic if the value is already set. The previous value can be disposed using dispose, but only if the value was allocated in Rust. The value can be forgotten using forget, but this can cause a memory leak.
Implementations§
source§impl<'a> RendererObject<'a>
impl<'a> RendererObject<'a>
sourcepub unsafe fn get<T>(&mut self) -> Option<&mut T>
pub unsafe fn get<T>(&mut self) -> Option<&mut T>
Gets the type pointed to by this renderer object.
§Safety
It is not guaranteed that the returned option has a valid object and could segfault if the renderer object is a different type than requested.
sourcepub unsafe fn get_unchecked<T>(&mut self) -> &mut T
pub unsafe fn get_unchecked<T>(&mut self) -> &mut T
Gets the type pointed to by this renderer object without a null check.
§Safety
It is not guaranteed that the returned option has a valid object and could segfault if the renderer object is a different type than requested.
sourcepub unsafe fn get_atlas_region(
&mut self
) -> Option<CTmpRef<'_, Self, AtlasRegion>>
pub unsafe fn get_atlas_region( &mut self ) -> Option<CTmpRef<'_, Self, AtlasRegion>>
Gets the atlas region on mesh and region attachments if the default attachment loader was used to create the skeleton.
§Safety
This function does not guarantee that the returned option has a valid AtlasRegion
and
could segfault if the renderer object is a different type.