-
-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Types such as ZendStr have an owned variant ZendString. This can be generically replaced with a type ZBox<T>, where T implements a new trait ZBoxable, which is implemented on Zend heap-allocated types, such as ZendStr, ZendObject and HashTable:
pub struct ZBox<T: ZBoxable>(NonNull<T>);
pub unsafe trait ZBoxable {
fn free(&mut self) {
// by default, just free the memory using the ZMM
// downstream types like strings and objects can override with their respective release functions
unsafe { efree(self) };
}
}ZBox will dereference to T, and downstream modules such as string can implement on ZBox<ZendStr>, such as impl TryFrom<String> for ZBox<ZendStr>.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request