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

facet-rs / facet / 15787779743

20 Jun 2025 09:01PM UTC coverage: 61.487% (+1.8%) from 59.711%
15787779743

Pull #774

github

web-flow
Merge dd04260c9 into ec93ce66e
Pull Request #774: split up Partial::end into smaller bits

147 of 165 new or added lines in 2 files covered. (89.09%)

1817 existing lines in 50 files now uncovered.

10564 of 17181 relevant lines covered (61.49%)

161.84 hits per line

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

57.41
/facet-core/src/impls_alloc/vec.rs
1
use crate::*;
2

3
use alloc::boxed::Box;
4
use alloc::vec::Vec;
5

6
type VecIterator<'mem, T> = core::slice::Iter<'mem, T>;
7

8
unsafe impl<'a, T> Facet<'a> for Vec<T>
9
where
10
    T: Facet<'a>,
11
{
12
    const VTABLE: &'static ValueVTable = &const {
13
        ValueVTable::builder::<Self>()
14
            .type_name(|f, opts| {
512✔
15
                if let Some(opts) = opts.for_children() {
512✔
16
                    write!(f, "{}<", Self::SHAPE.type_identifier)?;
512✔
17
                    T::SHAPE.vtable.type_name()(f, opts)?;
512✔
18
                    write!(f, ">")
512✔
19
                } else {
UNCOV
20
                    write!(f, "{}<⋯>", Self::SHAPE.type_identifier)
×
21
                }
22
            })
512✔
23
            .default_in_place(|| Some(|target| unsafe { target.put(Self::default()) }))
28✔
24
            .marker_traits(|| {
2✔
25
                MarkerTraits::SEND
26
                    .union(MarkerTraits::SYNC)
2✔
27
                    .union(MarkerTraits::EQ)
2✔
28
                    .union(MarkerTraits::UNPIN)
2✔
29
                    .union(MarkerTraits::UNWIND_SAFE)
2✔
30
                    .union(MarkerTraits::REF_UNWIND_SAFE)
2✔
31
                    .intersection(T::SHAPE.vtable.marker_traits())
2✔
32
            })
2✔
33
            .build()
34
    };
35

36
    const SHAPE: &'static Shape<'static> = &const {
37
        Shape::builder_for_sized::<Self>()
38
            .type_identifier("Vec")
39
            .type_params(&[TypeParam {
40
                name: "T",
41
                shape: || T::SHAPE,
42
            }])
43
            .ty(Type::User(UserType::Opaque))
44
            .def(Def::List(
45
                ListDef::builder()
46
                    .vtable(
47
                        &const {
48
                            ListVTable::builder()
49
                                .init_in_place_with_capacity(|data, capacity| unsafe {
50
                                    data.put(Self::with_capacity(capacity))
116✔
51
                                })
116✔
52
                                .push(|ptr, item| unsafe {
53
                                    let vec = ptr.as_mut::<Self>();
507✔
54
                                    let item = item.read::<T>();
507✔
55
                                    (*vec).push(item);
507✔
56
                                })
507✔
57
                                .len(|ptr| unsafe {
58
                                    let vec = ptr.get::<Self>();
26✔
59
                                    vec.len()
26✔
60
                                })
26✔
61
                                .get(|ptr, index| unsafe {
62
                                    let vec = ptr.get::<Self>();
17✔
63
                                    let item = vec.get(index)?;
17✔
64
                                    Some(PtrConst::new(item))
14✔
65
                                })
17✔
66
                                .get_mut(|ptr, index| unsafe {
UNCOV
67
                                    let vec = ptr.as_mut::<Self>();
×
UNCOV
68
                                    let item = vec.get_mut(index)?;
×
UNCOV
69
                                    Some(PtrMut::new(item))
×
70
                                })
×
71
                                .as_ptr(|ptr| unsafe {
72
                                    let vec = ptr.get::<Self>();
11✔
73
                                    PtrConst::new(vec.as_ptr())
11✔
74
                                })
11✔
75
                                .as_mut_ptr(|ptr| unsafe {
UNCOV
76
                                    let vec = ptr.as_mut::<Self>();
×
UNCOV
77
                                    PtrMut::new(vec.as_mut_ptr())
×
UNCOV
78
                                })
×
79
                                .iter_vtable(
80
                                    IterVTable::builder()
81
                                        .init_with_value(|ptr| unsafe {
UNCOV
82
                                            let vec = ptr.get::<Self>();
×
83
                                            let iter: VecIterator<T> = vec.iter();
×
84
                                            let iter_state = Box::new(iter);
×
UNCOV
85
                                            PtrMut::new(Box::into_raw(iter_state) as *mut u8)
×
UNCOV
86
                                        })
×
87
                                        .next(|iter_ptr| unsafe {
88
                                            let state = iter_ptr.as_mut::<VecIterator<'_, T>>();
×
89
                                            state.next().map(|value| PtrConst::new(value))
×
90
                                        })
×
91
                                        .next_back(|iter_ptr| unsafe {
92
                                            let state = iter_ptr.as_mut::<VecIterator<'_, T>>();
×
93
                                            state.next_back().map(|value| PtrConst::new(value))
×
UNCOV
94
                                        })
×
95
                                        .dealloc(|iter_ptr| unsafe {
UNCOV
96
                                            drop(Box::from_raw(
×
97
                                                iter_ptr.as_ptr::<VecIterator<'_, T>>()
×
UNCOV
98
                                                    as *mut VecIterator<'_, T>,
×
99
                                            ));
UNCOV
100
                                        })
×
101
                                        .build(),
102
                                )
103
                                .build()
104
                        },
105
                    )
106
                    .t(|| T::SHAPE)
107
                    .build(),
108
            ))
109
            .build()
110
    };
111
}
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

© 2026 Coveralls, Inc