pub type ZendIterator = zend_object_iterator;Expand description
A PHP Iterator.
In PHP, iterators are represented as zend_object_iterator. This allows
user to iterate over objects implementing Traversable interface using
foreach.
Use Iterable to iterate over both iterators and arrays.
Aliased Type§
#[repr(C)]pub struct ZendIterator {
pub std: _zend_object,
pub data: _zval_struct,
pub funcs: *const _zend_object_iterator_funcs,
pub index: u64,
}Fields§
§std: _zend_object§data: _zval_struct§funcs: *const _zend_object_iterator_funcs§index: u64Implementations§
Source§impl ZendIterator
impl ZendIterator
Sourcepub fn iter(&mut self) -> Option<Iter<'_>>
pub fn iter(&mut self) -> Option<Iter<'_>>
Creates a new rust iterator from a zend_object_iterator.
Returns a iterator over the zend_object_iterator, or None if the
iterator cannot be rewound.
Sourcepub fn valid(&mut self) -> bool
pub fn valid(&mut self) -> bool
Check if the current position of the iterator is valid.
As an example this will call the user defined valid method of the
\Iterator interface. see https://www.php.net/manual/en/iterator.valid.php
Sourcepub fn rewind(&mut self) -> bool
pub fn rewind(&mut self) -> bool
Rewind the iterator to the first element.
As an example this will call the user defined rewind method of the
\Iterator interface. see https://www.php.net/manual/en/iterator.rewind.php
§Returns
Returns true if the iterator was successfully rewind, false otherwise. (when there is an exception during rewind)
Sourcepub fn move_forward(&mut self) -> bool
pub fn move_forward(&mut self) -> bool
Move the iterator forward to the next element.
As an example this will call the user defined next method of the
\Iterator interface. see https://www.php.net/manual/en/iterator.next.php
§Returns
Returns true if the iterator was successfully move, false otherwise. (when there is an exception during next)
Sourcepub fn get_current_data(&mut self) -> Option<&Zval>
pub fn get_current_data(&mut self) -> Option<&Zval>
Get the current data of the iterator.
The reference borrows the iterator: Zend owns the returned zval and
releases it on the next move_forward,
rewind or when the iterator is destroyed
(zend_user_it_invalidate_current calls zval_ptr_dtor on it). Use
Zval::shallow_clone to keep the value across iterations.
§Returns
Returns a reference to the current data of the iterator if available
, None otherwise.
Trait Implementations§
Source§impl Debug for ZendIterator
impl Debug for ZendIterator
Source§impl<'a> FromZvalMut<'a> for &'a mut ZendIterator
impl<'a> FromZvalMut<'a> for &'a mut ZendIterator
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
null and may be omitted.Source§const BY_REF: bool = false
const BY_REF: bool = false
&$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>
None means the argument is required. Read more