-
Notifications
You must be signed in to change notification settings - Fork 211
Open
Labels
c: coreComponent: core (mod core_types, object, log, init, ...)Component: core (mod core_types, object, log, init, ...)quality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals
Milestone
Description
The sys, sys_mut and from_sys methods are placed on a lot of core wrappers, and also on the GodotObject trait (to_sys has the same signature as sys elsewhere). It might make sense to group them into a trait, which can reduce duplication and enable possible generic code later. The trait can be defined as:
unsafe trait SysConv: private::Sealed {
type Sys;
fn sys(&self) -> *const Self::Sys;
fn from_sys(sys: *const Self::Sys) -> Self;
fn sys_mut(&self) -> *mut Self::Sys {
self.sys() as *mut _
}
}Additionally, an internal derive macro can be provided in impl/proc_macros for simple wrappers that are non-generic and have one tuple field or a sys field. This can reduce some code duplication in core.
Metadata
Metadata
Assignees
Labels
c: coreComponent: core (mod core_types, object, log, init, ...)Component: core (mod core_types, object, log, init, ...)quality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals