Type Definition ext_php_rs::types::Zval[][src]

pub type Zval = zval;
Expand description

A zend value. This is the primary storage container used throughout the Zend engine.

A zval can be thought of as a Rust enum, a type that can contain different values such as integers, strings, objects etc.

Implementations

Creates a new, empty zval.

Returns the value of the zval if it is a long.

Returns the value of the zval if it is a bool.

Returns the value of the zval if it is a double.

Returns the value of the zval as a zend string, if it is a string.

Note that this functions output will not be the same as string(), as this function does not attempt to convert other types into a String.

Returns the value of the zval if it is a string.

If the zval does not contain a string, the function will check if it contains a double or a long, and if so it will convert the value to a String and return it. Don’t rely on this logic, as there is potential for this to change to match the output of the str() function.

Returns the value of the zval if it is a string.

Note that this functions output will not be the same as string(), as this function does not attempt to convert other types into a String, as it could not pass back a &str in those cases.

Returns the value of the zval if it is a string and can be unpacked into a vector of a given type. Similar to the unpack in PHP, except you can only unpack one type.

Safety

There is no way to tell if the data stored in the string is actually of the given type. The results of this function can also differ from platform-to-platform due to the different representation of some types on different platforms. Consult the pack function documentation for more details.

Returns the value of the zval if it is a resource.

Returns an immutable reference to the underlying zval hashtable if the zval contains an array.

Returns a mutable reference to the underlying zval hashtable if the zval contains an array.

Returns the value of the zval if it is an object.

Returns a mutable reference to the object contained in the Zval, if any.

Returns the value of the zval if it is a reference.

Returns a mutable reference to the underlying zval if it is a reference.

Returns the value of the zval if it is callable.

Returns the value of the zval if it is a pointer.

Safety

The caller must ensure that the pointer contained in the zval is in fact a pointer to an instance of T, as the zval has no way of defining the type of pointer.

Attempts to call the zval as a callable with a list of arguments to pass to the function. Note that a thrown exception inside the callable is not detectable, therefore you should check if the return value is valid rather than unwrapping. Returns a result containing the return value of the function, or an error.

You should not call this function directly, rather through the call_user_func macro.

Parameters
  • params - A list of parameters to call the function with.

Returns the type of the Zval.

Returns true if the zval is a long, false otherwise.

Returns true if the zval is null, false otherwise.

Returns true if the zval is true, false otherwise.

Returns true if the zval is false, false otherwise.

Returns true if the zval is a bool, false otherwise.

Returns true if the zval is a double, false otherwise.

Returns true if the zval is a string, false otherwise.

Returns true if the zval is a resource, false otherwise.

Returns true if the zval is an array, false otherwise.

Returns true if the zval is an object, false otherwise.

Returns true if the zval is a reference, false otherwise.

Returns true if the zval is callable, false otherwise.

Returns true if the zval contains a pointer, false otherwise.

Sets the value of the zval as a string. Returns nothing in a result when successful.

Parameters
  • val - The value to set the zval as.
  • persistent - Whether the string should persist between requests.

Sets the value of the zval as a Zend string.

Parameters
  • val - String content.

Sets the value of the zval as a binary string, which is represented in Rust as a vector.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as a interned string. Returns nothing in a result when successful.

Parameters
  • val - The value to set the zval as.
  • persistent - Whether the string should persist between requests.

Sets the value of the zval as a long.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as a double.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as a boolean.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as null.

This is the default of a zval.

Sets the value of the zval as a resource.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as a reference to an object.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as an array. Returns nothing in a result on success.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as an array. Returns nothing in a result on success.

Parameters
  • val - The value to set the zval as.

Sets the value of the zval as a pointer.

Parameters
  • ptr - The pointer to set the zval as.

Extracts some type from a Zval.

This is a wrapper function around TryFrom.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

The corresponding type of the implemented value in PHP.

Attempts to retrieve an instance of Self from a reference to a Zval. Read more

The corresponding type of the implemented value in PHP.

Attempts to retrieve an instance of Self from a mutable reference to a Zval. Read more

The corresponding type of the implemented value in PHP.

Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more

Converts a Rust primitive type into a Zval. Returns a result containing the Zval if successful. 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.

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.

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.

The type returned in the event of a conversion error.

Performs the conversion.