Struct ext_php_rs::builders::ClassBuilder[][src]

pub struct ClassBuilder { /* fields omitted */ }
Expand description

Builder for registering a class in PHP.

Implementations

Creates a new class builder, used to build classes to be exported to PHP.

Parameters
  • name - The name of the class.

Sets the class builder to extend another class.

Parameters
  • parent - The parent class to extend.

Implements an interface on the class.

Parameters
  • interface - Interface to implement on the class.
Panics

Panics when the given class entry interface is not an interface.

Adds a method to the class.

Parameters
  • func - The function entry to add to the class.
  • flags - Flags relating to the function. See MethodFlags.

Adds a property to the class. The initial type of the property is given by the type of the given default. Note that the user can change the type.

Parameters
  • name - The name of the property to add to the class.
  • default - The default value of the property.
  • flags - Flags relating to the property. See PropertyFlags.
Panics

Function will panic if the given default cannot be converted into a Zval.

Adds a constant to the class. The type of the constant is defined by the type of the given default.

Returns a result containing the class builder if the constant was successfully added.

Parameters
  • name - The name of the constant to add to the class.
  • value - The value of the constant.

Sets the flags for the class.

Parameters
  • flags - Flags relating to the class. See ClassFlags.

Overrides the creation of the Zend object which will represent an instance of this class.

Parameters
  • T - The type which will override the Zend object. Must implement RegisteredClass which can be derived using the php_class attribute macro.
Panics

Panics if the class name associated with T is not the same as the class name specified when creating the builder.

Builds the class, returning a reference to the class entry.

Errors

Returns an Error variant if the class could not be registered.

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

Performs the conversion.

Performs the conversion.

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.