@@ -7,8 +7,8 @@ use std::fmt::{Debug, Display, Formatter};
77
88/// A PHP Iterator.
99///
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.
1212pub type ZendIterator = zend_object_iterator ;
1313
1414impl ZendIterator {
@@ -29,8 +29,8 @@ impl ZendIterator {
2929
3030 /// Check if the current position of the iterator is valid.
3131 ///
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>
3434 pub fn valid ( & mut self ) -> bool {
3535 if let Some ( valid) = unsafe { ( * self . funcs ) . valid } {
3636 let valid = unsafe { valid ( & mut * self ) == ZEND_RESULT_CODE_SUCCESS } ;
@@ -47,13 +47,13 @@ impl ZendIterator {
4747
4848 /// Rewind the iterator to the first element.
4949 ///
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>
5252 ///
5353 /// # Returns
5454 ///
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)
5757 pub fn rewind ( & mut self ) -> bool {
5858 if let Some ( rewind) = unsafe { ( * self . funcs ) . rewind } {
5959 unsafe {
@@ -66,13 +66,13 @@ impl ZendIterator {
6666
6767 /// Move the iterator forward to the next element.
6868 ///
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>
7171 ///
7272 /// # Returns
7373 ///
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)
7676 pub fn move_forward ( & mut self ) -> bool {
7777 if let Some ( move_forward) = unsafe { ( * self . funcs ) . move_forward } {
7878 unsafe {
@@ -104,8 +104,8 @@ impl ZendIterator {
104104 ///
105105 /// # Returns
106106 ///
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.
109109 pub fn get_current_key ( & mut self ) -> Option < Zval > {
110110 let get_current_key = unsafe { ( * self . funcs ) . get_current_key ? } ;
111111 let mut key = Zval :: new ( ) ;
@@ -178,7 +178,8 @@ impl<'a> Iterator for Iter<'a> {
178178 type Item = ( IterKey , & ' a Zval ) ;
179179
180180 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
182183 if self . zi . index > 0 && !self . zi . move_forward ( ) {
183184 return None ;
184185 }
0 commit comments