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: u64
Implementations§
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)