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
sourceimpl<'a> RendererObject<'a>
impl<'a> RendererObject<'a>
sourcepub fn set<T>(&mut self, data: T)
pub fn set<T>(&mut self, data: T)
Set the renderer object to a Rust object. Panics if the renderer object is already set. Must be manually freed later using dispose.
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. It is not guaranteed that the returned option has a valid object and could segfault if the renderer object is a different type.
pub unsafe fn get_unchecked<T>(&mut self) -> &mut T
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. This function does not guarantee that the returned option has a valid AtlasRegion and could segfault if the renderer object is a different type.