Type Definition ext_php_rs::zend::ZendObjectHandlers

source ·
pub type ZendObjectHandlers = zend_object_handlers;
Expand description

A set of functions associated with a PHP class.

Implementations§

Creates a new set of object handlers based on the standard object handlers.

Initializes a given set of object handlers by copying the standard object handlers into the memory location, as well as setting up the T type destructor.

Parameters
  • ptr - Pointer to memory location to copy the standard handlers to.
Safety

Caller must guarantee that the ptr given is a valid memory location.

Examples found in repository?
src/zend/handlers.rs (line 25)
21
22
23
24
25
26
27
28
29
30
    pub fn new<T: RegisteredClass>() -> ZendObjectHandlers {
        let mut this = MaybeUninit::uninit();

        // SAFETY: `this` is allocated on the stack and is a valid memory location.
        unsafe { Self::init::<T>(&mut *this.as_mut_ptr()) };

        // SAFETY: We just initialized the handlers in the previous statement, therefore
        // we are returning a valid object.
        unsafe { this.assume_init() }
    }