pub enum Iterable<'a> {
Array(&'a ZendHashTable),
Traversable(&'a mut ZendIterator),
}Expand description
This type represents a PHP iterable, which can be either an array or an object implementing the Traversable interface.
An Iterable can only be extracted from a mutable Zval, via
FromZvalMut. Resolving the Traversable variant invokes the Zend
get_iterator handler, which mutates the object, so a shared borrow is not
enough:
ⓘ
use ext_php_rs::{convert::FromZvalMut, types::{Iterable, Zval}};
fn extract(zval: &Zval) -> Option<Iterable<'_>> {
Iterable::from_zval_mut(zval)
}Variants§
Array(&'a ZendHashTable)
Iterable is an Array
Traversable(&'a mut ZendIterator)
Iterable is a Traversable
Implementations§
Trait Implementations§
Source§impl<'a> FromZvalMut<'a> for Iterable<'a>
impl<'a> FromZvalMut<'a> for Iterable<'a>
Source§const TYPE: DataType = DataType::Iterable
const TYPE: DataType = DataType::Iterable
The corresponding type of the implemented value in PHP.
Source§fn from_zval_mut(zval: &'a mut Zval) -> Option<Self>
fn from_zval_mut(zval: &'a mut Zval) -> Option<Self>
Source§const NULLABLE: bool = false
const NULLABLE: bool = false
Whether a PHP argument of this type accepts
null and may be omitted.Source§const BY_REF: bool = false
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.Source§fn from_missing() -> Option<Self>
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. Read moreSource§impl<'a> IntoIterator for &'a mut Iterable<'a>
impl<'a> IntoIterator for &'a mut Iterable<'a>
Auto Trait Implementations§
impl<'a> !Send for Iterable<'a>
impl<'a> !Sync for Iterable<'a>
impl<'a> !UnwindSafe for Iterable<'a>
impl<'a> Freeze for Iterable<'a>
impl<'a> RefUnwindSafe for Iterable<'a>
impl<'a> Unpin for Iterable<'a>
impl<'a> UnsafeUnpin for Iterable<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more