pub struct ModuleBuilder { /* private fields */ }
Expand description

Builds a Zend module extension to be registered with PHP. Must be called from within an external function called get_module, returning a mutable pointer to a ModuleEntry.

use ext_php_rs::{
    builders::ModuleBuilder,
    zend::ModuleEntry,
    info_table_start, info_table_end, info_table_row
};

#[no_mangle]
pub extern "C" fn php_module_info(_module: *mut ModuleEntry) {
    info_table_start!();
    info_table_row!("column 1", "column 2");
    info_table_end!();
}

#[no_mangle]
pub extern "C" fn get_module() -> *mut ModuleEntry {
    ModuleBuilder::new("ext-name", "ext-version")
        .info_function(php_module_info)
        .build()
        .unwrap()
        .into_raw()
}

Implementations§

Creates a new module builder with a given name and version.

Arguments
  • name - The name of the extension.
  • version - The current version of the extension.

Sets the startup function for the extension.

Arguments
  • func - The function to be called on startup.

Sets the shutdown function for the extension.

Arguments
  • func - The function to be called on shutdown.

Sets the request startup function for the extension.

Arguments
  • func - The function to be called when startup is requested.

Sets the request shutdown function for the extension.

Arguments
  • func - The function to be called when shutdown is requested.

Sets the extension information function for the extension.

Arguments
  • func - The function to be called to retrieve the information about the extension.

Adds a function to the extension.

Arguments
  • func - The function to be added to the extension.

Builds the extension and returns a ModuleEntry.

Returns a result containing the module entry if successful.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.