Struct ext_php_rs::ffi::_zend_function_entry
source · #[repr(C)]pub struct _zend_function_entry {
pub fname: *const c_char,
pub handler: zif_handler,
pub arg_info: *const _zend_internal_arg_info,
pub num_args: u32,
pub flags: u32,
}
Fields§
§fname: *const c_char
§handler: zif_handler
§arg_info: *const _zend_internal_arg_info
§num_args: u32
§flags: u32
Implementations§
source§impl _zend_function_entry
impl _zend_function_entry
sourcepub fn end() -> Self
pub fn end() -> Self
Returns an empty function entry, signifing the end of a function list.
Examples found in repository?
More examples
src/builders/class.rs (line 231)
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
pub fn build(mut self) -> Result<&'static mut ClassEntry> {
self.ce.name = ZendStr::new_interned(&self.name, true).into_raw();
self.methods.push(FunctionEntry::end());
let func = Box::into_raw(self.methods.into_boxed_slice()) as *const FunctionEntry;
self.ce.info.internal.builtin_functions = func;
let class = unsafe {
zend_register_internal_class_ex(
&mut self.ce,
match self.extends {
Some(ptr) => (ptr as *const _) as *mut _,
None => std::ptr::null_mut(),
},
)
.as_mut()
.ok_or(Error::InvalidPointer)?
};
// disable serialization if the class has an associated object
if self.object_override.is_some() {
cfg_if::cfg_if! {
if #[cfg(any(php81, php82))] {
class.ce_flags |= ClassFlags::NotSerializable.bits();
} else {
class.serialize = Some(crate::ffi::zend_class_serialize_deny);
class.unserialize = Some(crate::ffi::zend_class_unserialize_deny);
}
}
}
for iface in self.interfaces {
unsafe {
zend_do_implement_interface(
class,
iface as *const crate::ffi::_zend_class_entry
as *mut crate::ffi::_zend_class_entry,
)
};
}
for (name, mut default, flags) in self.properties {
unsafe {
zend_declare_property(
class,
CString::new(name.as_str())?.as_ptr(),
name.len() as _,
&mut default,
flags.bits() as _,
);
}
}
for (name, value) in self.constants {
let value = Box::into_raw(Box::new(value));
unsafe {
zend_declare_class_constant(
class,
CString::new(name.as_str())?.as_ptr(),
name.len(),
value,
)
};
}
if let Some(object_override) = self.object_override {
class.__bindgen_anon_2.create_object = Some(object_override);
}
Ok(class)
}
Trait Implementations§
source§impl Clone for _zend_function_entry
impl Clone for _zend_function_entry
source§fn clone(&self) -> _zend_function_entry
fn clone(&self) -> _zend_function_entry
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more