Skip to main content

FromZvalMut

Trait FromZvalMut 

Source
pub trait FromZvalMut<'a>: Sized {
    const TYPE: DataType;
    const NULLABLE: bool = false;
    const BY_REF: bool = false;

    // Required method
    fn from_zval_mut(zval: &'a mut Zval) -> Option<Self>;

    // Provided method
    fn from_missing() -> Option<Self> { ... }
}
Expand description

Allows mutable zvals to be converted into Rust types in a fallible way.

If Self does not require the zval to be mutable to be extracted, you should implement FromZval instead, as this trait is generically implemented for any type that implements FromZval.

Required Associated Constants§

Source

const TYPE: DataType

The corresponding type of the implemented value in PHP.

Provided Associated Constants§

Source

const NULLABLE: bool = false

Whether a PHP argument of this type accepts null and may be omitted.

Source

const BY_REF: bool = false

Whether a PHP argument of this type is declared pass-by-reference (&$arg). Set it for types that mutate a PHP value in place, so the engine separates the value before the call.

Required Methods§

Source

fn from_zval_mut(zval: &'a mut Zval) -> Option<Self>

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

§Parameters
  • zval - Zval to get value from.

Provided Methods§

Source

fn from_missing() -> Option<Self>

The value to use when a PHP argument of this type was omitted by the caller. None means the argument is required.

It must return Some exactly when NULLABLE is true. The macros decide from NULLABLE alone which parameters PHP callers may omit.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> FromZvalMut<'a> for Option<&'a mut ZendHashTable>

Source§

const TYPE: DataType = DataType::Array

Source§

const NULLABLE: bool = true

Source§

const BY_REF: bool = true

Source§

fn from_zval_mut(zval: &'a mut Zval) -> Option<Self>

Source§

fn from_missing() -> Option<Self>

Implementors§

Source§

impl<'a, T: RegisteredClass> FromZvalMut<'a> for &'a mut ZendClassObject<T>

Source§

impl<'a, T> FromZvalMut<'a> for T
where T: FromZval<'a>,

Source§

const TYPE: DataType = <T as FromZval>::TYPE

Source§

const NULLABLE: bool = <T as FromZval>::NULLABLE

Source§

impl<'a> FromZvalMut<'a> for &'a mut Closure

Available on crate feature closure only.
Source§

impl<'a> FromZvalMut<'a> for &'a mut ZendHashTable

Source§

const TYPE: DataType = DataType::Array

Source§

const BY_REF: bool = true

Source§

impl<'a> FromZvalMut<'a> for &'a mut ZendIterator

Source§

impl<'a> FromZvalMut<'a> for &'a mut ZendObject

Source§

const TYPE: DataType = DataType::ANY_OBJECT

Source§

impl<'a> FromZvalMut<'a> for &'a mut Zval

Source§

const TYPE: DataType = DataType::Mixed

Source§

const BY_REF: bool = true

Source§

impl<'a> FromZvalMut<'a> for Iterable<'a>

Source§

const TYPE: DataType = DataType::Iterable

Source§

impl<'a> FromZvalMut<'a> for PhpRef<'a>

Source§

const TYPE: DataType = DataType::Mixed

Source§

const BY_REF: bool = true

Source§

impl<'a> FromZvalMut<'a> for Separated<'a>

Source§

const TYPE: DataType = DataType::Mixed