Skip to main content

IntoZvalDyn

Trait IntoZvalDyn 

Source
pub trait IntoZvalDyn {
    // Required methods
    fn as_zval(&self, persistent: bool) -> Result<Zval>;
    fn get_type(&self) -> DataType;

    // Provided method
    fn stub_value(&self) -> String { ... }
}
Expand description

An object-safe version of the IntoZval trait.

This trait is automatically implemented on any type that implements both IntoZval and Clone. You avoid implementing this trait directly, rather implement these two other traits.

Required Methods§

Source

fn as_zval(&self, persistent: bool) -> Result<Zval>

Converts a Rust primitive type into a Zval. Returns a result containing the Zval if successful. self is cloned before being converted into a zval.

§Parameters
  • persistent - Whether the contents of the Zval will persist between requests.
§Errors

If the conversion fails, an Error is returned.

Source

fn get_type(&self) -> DataType

Returns the PHP type of the type.

Provided Methods§

Source

fn stub_value(&self) -> String

Returns the PHP stub representation of this value.

This is used when generating PHP stub files for IDE autocompletion. The returned string should be a valid PHP literal.

Implementors§