• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

davidcole1340 / ext-php-rs / 15788182852

20 Jun 2025 09:32PM UTC coverage: 22.034%. Remained the same
15788182852

Pull #460

github

web-flow
Merge d4fc01bb5 into 660f308c0
Pull Request #460: chore(clippy): flowing lifetimes warning and clippy::mut_from_ref

6 of 56 new or added lines in 13 files covered. (10.71%)

3 existing lines in 2 files now uncovered.

871 of 3953 relevant lines covered (22.03%)

2.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/zend/linked_list.rs
1
use std::{marker::PhantomData, ptr};
2

3
use crate::ffi::{zend_llist, zend_llist_element, zend_llist_get_next_ex};
4

5
/// PHP linked list
6
pub type ZendLinkedList = zend_llist;
7

8
impl ZendLinkedList {
9
    /// Create an iterator over the linked list
10
    #[must_use]
NEW
11
    pub fn iter<T>(&self) -> ZendLinkedListIterator<'_, T> {
×
12
        ZendLinkedListIterator::new(self)
×
13
    }
14
}
15

16
pub struct ZendLinkedListIterator<'a, T> {
17
    list: &'a zend_llist,
18
    position: *mut zend_llist_element,
19
    _marker: PhantomData<T>,
20
}
21

22
impl<'a, T> ZendLinkedListIterator<'a, T> {
23
    fn new(list: &'a ZendLinkedList) -> Self {
×
24
        ZendLinkedListIterator {
25
            list,
26
            position: list.head,
×
27
            _marker: PhantomData,
28
        }
29
    }
30
}
31

32
impl<'a, T: 'a> Iterator for ZendLinkedListIterator<'a, T> {
33
    type Item = &'a T;
34

35
    fn next(&mut self) -> Option<Self::Item> {
×
36
        if self.position.is_null() {
×
37
            return None;
×
38
        }
39
        let ptr = unsafe { (*self.position).data.as_mut_ptr() };
×
40
        let value = unsafe { &*((ptr as *const T).cast_mut()) };
×
41
        unsafe {
42
            zend_llist_get_next_ex(
43
                ptr::from_ref::<ZendLinkedList>(self.list).cast_mut(),
×
NEW
44
                &raw mut self.position,
×
45
            )
46
        };
47
        Some(value)
×
48
    }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc