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

facet-rs / facet / 14419059906

12 Apr 2025 11:12AM UTC coverage: 32.106% (-0.5%) from 32.576%
14419059906

Pull #180

github

web-flow
Merge 069c63ea2 into 4b37a5a95
Pull Request #180: Impl `Facet` for `Arc<T>`

41 of 209 new or added lines in 7 files covered. (19.62%)

45 existing lines in 1 file now uncovered.

2032 of 6329 relevant lines covered (32.11%)

13.47 hits per line

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

70.0
/facet-core/src/_trait/impls/smart_pointer_impls.rs
1
use core::alloc::Layout;
2

3
use crate::{
4
    ConstTypeId, Def, Facet, OpaqueConst, SmartPointerDef, SmartPointerFlags, SmartPointerVTable,
5
    value_vtable,
6
};
7

8
#[cfg(feature = "alloc")]
9
unsafe impl<T: Facet> Facet for alloc::sync::Arc<T> {
10
    const SHAPE: &'static crate::Shape = &const {
11
        crate::Shape::builder()
12
            .id(ConstTypeId::of::<Self>())
13
            .layout(Layout::new::<Self>())
14
            .def(Def::SmartPointer(
15
                SmartPointerDef::builder()
16
                    .t(T::SHAPE)
17
                    .flags(SmartPointerFlags::ATOMIC)
18
                    .known(Some(crate::KnownSmartPointer::Arc))
19
                    .vtable(
20
                        &const {
21
                            SmartPointerVTable::builder()
22
                                .borrow_fn(|opaque| {
1✔
23
                                    let ptr = Self::as_ptr(unsafe { opaque.as_ref() });
1✔
24
                                    OpaqueConst::new(ptr)
1✔
25
                                })
26
                                .new_into_fn(|this, ptr| {
1✔
27
                                    let t = unsafe { ptr.read::<T>() };
1✔
28
                                    let arc = alloc::sync::Arc::new(t);
1✔
29
                                    unsafe { this.put(arc) }
1✔
30
                                })
31
                                .build()
32
                        },
33
                    )
34
                    .build(),
35
            ))
NEW
36
            .vtable(value_vtable!(alloc::sync::Arc<T>, |f, _opts| write!(
×
NEW
37
                f,
×
NEW
38
                "Arc"
×
39
            )))
40
            .build()
41
    };
42
}
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