@@ -7,8 +7,8 @@ use std::fmt::{Debug, Display, Formatter};
7
7
8
8
/// A PHP Iterator.
9
9
///
10
- /// In PHP, iterators are represented as zend_object_iterator. This allow user to iterate
11
- /// over object implementing Traversable interface using foreach.
10
+ /// In PHP, iterators are represented as zend_object_iterator. This allow user
11
+ /// to iterate over object implementing Traversable interface using foreach.
12
12
pub type ZendIterator = zend_object_iterator ;
13
13
14
14
impl ZendIterator {
@@ -29,8 +29,8 @@ impl ZendIterator {
29
29
30
30
/// Check if the current position of the iterator is valid.
31
31
///
32
- /// As an example this will call the user defined valid method of the ['\Iterator'] interface.
33
- /// see <https://www.php.net/manual/en/iterator.valid.php>
32
+ /// As an example this will call the user defined valid method of the
33
+ /// ['\Iterator'] interface. see <https://www.php.net/manual/en/iterator.valid.php>
34
34
pub fn valid ( & mut self ) -> bool {
35
35
if let Some ( valid) = unsafe { ( * self . funcs ) . valid } {
36
36
let valid = unsafe { valid ( & mut * self ) == ZEND_RESULT_CODE_SUCCESS } ;
@@ -47,13 +47,13 @@ impl ZendIterator {
47
47
48
48
/// Rewind the iterator to the first element.
49
49
///
50
- /// As an example this will call the user defined rewind method of the ['\Iterator'] interface.
51
- /// see <https://www.php.net/manual/en/iterator.rewind.php>
50
+ /// As an example this will call the user defined rewind method of the
51
+ /// ['\Iterator'] interface. see <https://www.php.net/manual/en/iterator.rewind.php>
52
52
///
53
53
/// # Returns
54
54
///
55
- /// Returns true if the iterator was successfully rewind, false otherwise. (when there is
56
- /// an exception during rewind)
55
+ /// Returns true if the iterator was successfully rewind, false otherwise.
56
+ /// (when there is an exception during rewind)
57
57
pub fn rewind ( & mut self ) -> bool {
58
58
if let Some ( rewind) = unsafe { ( * self . funcs ) . rewind } {
59
59
unsafe {
@@ -66,13 +66,13 @@ impl ZendIterator {
66
66
67
67
/// Move the iterator forward to the next element.
68
68
///
69
- /// As an example this will call the user defined next method of the ['\Iterator'] interface.
70
- /// see <https://www.php.net/manual/en/iterator.next.php>
69
+ /// As an example this will call the user defined next method of the
70
+ /// ['\Iterator'] interface. see <https://www.php.net/manual/en/iterator.next.php>
71
71
///
72
72
/// # Returns
73
73
///
74
- /// Returns true if the iterator was successfully move, false otherwise. (when there is
75
- /// an exception during next)
74
+ /// Returns true if the iterator was successfully move, false otherwise.
75
+ /// (when there is an exception during next)
76
76
pub fn move_forward ( & mut self ) -> bool {
77
77
if let Some ( move_forward) = unsafe { ( * self . funcs ) . move_forward } {
78
78
unsafe {
@@ -104,8 +104,8 @@ impl ZendIterator {
104
104
///
105
105
/// # Returns
106
106
///
107
- /// Returns a new ['Zval'] containing the current key of the iterator if available
108
- /// , ['None'] otherwise.
107
+ /// Returns a new ['Zval'] containing the current key of the iterator if
108
+ /// available , ['None'] otherwise.
109
109
pub fn get_current_key ( & mut self ) -> Option < Zval > {
110
110
let get_current_key = unsafe { ( * self . funcs ) . get_current_key ? } ;
111
111
let mut key = Zval :: new ( ) ;
@@ -178,7 +178,8 @@ impl<'a> Iterator for Iter<'a> {
178
178
type Item = ( IterKey , & ' a Zval ) ;
179
179
180
180
fn next ( & mut self ) -> Option < Self :: Item > {
181
- // Call next when index > 0, so next is really called at the start of each iteration, which allow to work better with generator iterator
181
+ // Call next when index > 0, so next is really called at the start of each
182
+ // iteration, which allow to work better with generator iterator
182
183
if self . zi . index > 0 && !self . zi . move_forward ( ) {
183
184
return None ;
184
185
}
0 commit comments