mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-27 04:24:54 +01:00
Updated inline documentation
This commit is contained in:
parent
45c7242f1e
commit
35808d9e49
@ -51,10 +51,10 @@ macro_rules! _info_table_row {
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `$fn` - The 'function' to call. Can be an [Arg](crate::php::args::Arg) or a
|
||||
/// [Zval](crate::php::types::zval::Zval).
|
||||
/// * `$fn` - The 'function' to call. Can be an [`Arg`](crate::php::args::Arg) or a
|
||||
/// [`Zval`](crate::php::types::zval::Zval).
|
||||
/// * ...`$param` - The parameters to pass to the function. Must be able to be converted into a
|
||||
/// (crate::php::types::zval::Zval).
|
||||
/// [`Zval`](crate::php::types::zval::Zval).
|
||||
#[macro_export]
|
||||
macro_rules! call_user_func {
|
||||
($fn: expr, $($param: expr),*) => {
|
||||
@ -62,7 +62,7 @@ macro_rules! call_user_func {
|
||||
};
|
||||
}
|
||||
|
||||
/// Parses a given list of arguments using the [ArgParser](crate::php::args::ArgParser) class.
|
||||
/// Parses a given list of arguments using the [`ArgParser`](crate::php::args::ArgParser) class.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -144,7 +144,8 @@ impl<'a> ClassBuilder<'a> {
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `T` - The type which will override the Zend object. Must implement [`ZendObjectOverride`]
|
||||
/// which can be implemented through the [`object_override_handler`] macro.
|
||||
/// which can be derived through the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler)
|
||||
/// derive macro.
|
||||
pub fn object_override<T: ZendObjectOverride>(mut self) -> Self {
|
||||
self.object_override = Some(T::create_object);
|
||||
self
|
||||
|
@ -17,8 +17,8 @@ use crate::{
|
||||
pub type ZendObject = zend_object;
|
||||
pub type ZendObjectHandlers = zend_object_handlers;
|
||||
|
||||
/// Implemented by the [`object_override_handler`] macro on a type T which is used as the T type
|
||||
/// for [`ZendClassObject`].
|
||||
/// Implemented by the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) macro on a type T
|
||||
/// which is used as the T type for [`ZendClassObject`].
|
||||
/// Implements a function `create_object` which is passed to a PHP class entry to instantiate the
|
||||
/// object that will represent an object.
|
||||
pub trait ZendObjectOverride {
|
||||
@ -42,12 +42,11 @@ pub struct ZendClassObject<T: Default> {
|
||||
}
|
||||
|
||||
impl<T: Default> ZendClassObject<T> {
|
||||
/// Allocates a new object when an instance of the class is created
|
||||
/// in the PHP world.
|
||||
/// Allocates a new object when an instance of the class is created in the PHP world.
|
||||
///
|
||||
/// Internal function. The end user functions are generated by the
|
||||
/// [`object_override_handler`] macro which generates a function that
|
||||
/// wraps this function to be exported to C.
|
||||
/// [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) derive macro which generates a
|
||||
/// function that wraps this function to be exported to C.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
@ -56,13 +55,10 @@ impl<T: Default> ZendClassObject<T> {
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is an internal function which is called only from
|
||||
/// the function generated by the [`object_override_handler`] macro,
|
||||
/// which in turn is called from the PHP runtime. PHP guarantees that
|
||||
/// the given [`ClassEntry`] is valid. The `handlers` to this function
|
||||
/// are also initialized by the [`object_handlers_init`] macro.
|
||||
/// However, we cannot ensure the user will call both of these macros
|
||||
/// in the same place.
|
||||
/// This function is an internal function which is only called from code which is derived using
|
||||
/// the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) derive macro. PHP will
|
||||
/// guarantee that any pointers given to this function will be valid, therefore we can Unwrap
|
||||
/// them with safety.
|
||||
pub unsafe fn new_ptr(
|
||||
ce: *mut ClassEntry,
|
||||
handlers: *mut ZendObjectHandlers,
|
||||
|
Loading…
Reference in New Issue
Block a user