Updated inline documentation

This commit is contained in:
David Cole 2021-04-18 14:41:51 +12:00
parent 45c7242f1e
commit 35808d9e49
3 changed files with 15 additions and 18 deletions

View File

@ -51,10 +51,10 @@ macro_rules! _info_table_row {
/// ///
/// # Parameters /// # Parameters
/// ///
/// * `$fn` - The 'function' to call. Can be an [Arg](crate::php::args::Arg) or a /// * `$fn` - The 'function' to call. Can be an [`Arg`](crate::php::args::Arg) or a
/// [Zval](crate::php::types::zval::Zval). /// [`Zval`](crate::php::types::zval::Zval).
/// * ...`$param` - The parameters to pass to the function. Must be able to be converted into a /// * ...`$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_export]
macro_rules! call_user_func { macro_rules! call_user_func {
($fn: expr, $($param: expr),*) => { ($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 /// # Examples
/// ///

View File

@ -144,7 +144,8 @@ impl<'a> ClassBuilder<'a> {
/// # Parameters /// # Parameters
/// ///
/// * `T` - The type which will override the Zend object. Must implement [`ZendObjectOverride`] /// * `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 { pub fn object_override<T: ZendObjectOverride>(mut self) -> Self {
self.object_override = Some(T::create_object); self.object_override = Some(T::create_object);
self self

View File

@ -17,8 +17,8 @@ use crate::{
pub type ZendObject = zend_object; pub type ZendObject = zend_object;
pub type ZendObjectHandlers = zend_object_handlers; pub type ZendObjectHandlers = zend_object_handlers;
/// Implemented by the [`object_override_handler`] macro on a type T which is used as the T type /// Implemented by the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) macro on a type T
/// for [`ZendClassObject`]. /// 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 /// Implements a function `create_object` which is passed to a PHP class entry to instantiate the
/// object that will represent an object. /// object that will represent an object.
pub trait ZendObjectOverride { pub trait ZendObjectOverride {
@ -42,12 +42,11 @@ pub struct ZendClassObject<T: Default> {
} }
impl<T: Default> ZendClassObject<T> { impl<T: Default> ZendClassObject<T> {
/// Allocates a new object when an instance of the class is created /// Allocates a new object when an instance of the class is created in the PHP world.
/// in the PHP world.
/// ///
/// Internal function. The end user functions are generated by the /// Internal function. The end user functions are generated by the
/// [`object_override_handler`] macro which generates a function that /// [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) derive macro which generates a
/// wraps this function to be exported to C. /// function that wraps this function to be exported to C.
/// ///
/// # Parameters /// # Parameters
/// ///
@ -56,13 +55,10 @@ impl<T: Default> ZendClassObject<T> {
/// ///
/// # Safety /// # Safety
/// ///
/// This function is an internal function which is called only from /// This function is an internal function which is only called from code which is derived using
/// the function generated by the [`object_override_handler`] macro, /// the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) derive macro. PHP will
/// which in turn is called from the PHP runtime. PHP guarantees that /// guarantee that any pointers given to this function will be valid, therefore we can Unwrap
/// the given [`ClassEntry`] is valid. The `handlers` to this function /// them with safety.
/// 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.
pub unsafe fn new_ptr( pub unsafe fn new_ptr(
ce: *mut ClassEntry, ce: *mut ClassEntry,
handlers: *mut ZendObjectHandlers, handlers: *mut ZendObjectHandlers,