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

facet-rs / facet / 19993677870

06 Dec 2025 08:12PM UTC coverage: 58.752% (+0.05%) from 58.705%
19993677870

push

github

fasterthanlime
Reduce/cordon bloat in facet, introduce bloatbench

Looks into codegen size, compile times etc. - again :) after adding a buuuunch of features.

- [x] Disable miette's default features (derive, which depends on syn) (`b.miette`)
- [x] Don't enable miette fancy by default in facet-json (`b.miette-fancy`)
- [x] Flatten closures in facet-json to avoid generic instantiations (`b.flatten-closures`)
- [x] Get rid of shape_of in Shape derive, use `#field_type` directly (`b.shape-of`)
- [x] Detect known derives in facet-macros, eschew impls! for them (`b.detect-derives`)
- [x] Gate nonzero impls, net impls (`b.gate-impls`)
- [x] Gate doc-comments, vtable-fmt, vtable-cmp, vtable-hash (`b.gate-vtable`)
- [x] Make 'auto trait detection' opt-in (`b.auto-traits-optin`)
- [x] Detect traits from `derive` and from `#[facet(default)]` (`b.derive-traits`)
- [x] Allow manual trait specification via `#[facet(traits(...))]` (`b.manual-traits`)
- [x] Go back to builders (they expand to less code) (`b.builders`)
- [x] VTable restructured with sub-vtables (`format`, `cmp`, `hash`, `markers`) (`b.vtable-substruct`)
- [x] Convert manual impls to ShapeBuilder (`scalar.rs`, `fn_ptr.rs`, `impls_num_complex.rs`) (`b.shapebuilder`)
- [x] **Confirmed**: `#![allow(uncommon_codepoints, nonstandard_style)]` in library = no warnings in consumers (`b.unicode-test`)
- [x] Add `FieldBuilder::new(name, shape_fn, offset)` builder (`b.field-builder`)
- [x] Add `StructTypeBuilder::new(kind, fields)` builder (`b.structtype-builder`)
- [x] Add `VariantBuilder::new(name, data)` builder (`b.variant-builder`)
- [x] Add `EnumTypeBuilder::new(enum_repr, variants)` builder (`b.enumtype-builder`)
- [x] Create `::facet::𝟋` module with type aliases and builder exports (`b.prelude-mod`)
- [x] Update derive macro to use builder pattern for Field, StructType, Variant, EnumType (`b.derive-builders`)

Based on analysis in `facet-bloatbench/MACRO-OPTIMIZATION-ANALYSIS.md`:

- [x] Remove `let mut vtable = const... (continued)

1199 of 3227 new or added lines in 72 files covered. (37.16%)

145 existing lines in 29 files now uncovered.

24253 of 41280 relevant lines covered (58.75%)

504.69 hits per line

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

0.0
/facet-core/src/impls_std/path.rs
1
use crate::*;
2

3
unsafe impl Facet<'_> for std::path::PathBuf {
4
    const SHAPE: &'static Shape = &const {
5
        Shape {
6
            id: Shape::id_of::<Self>(),
7
            layout: Shape::layout_of::<Self>(),
NEW
8
            vtable: value_vtable!(std::path::PathBuf, |f, _opts| write!(
×
UNCOV
9
                f,
×
10
                "{}",
11
                Self::SHAPE.type_identifier
×
12
            )),
13
            ty: Type::User(UserType::Opaque),
14
            def: Def::Scalar,
15
            type_identifier: "PathBuf",
16
            type_params: &[],
17
            doc: &[],
18
            attributes: &[],
19
            type_tag: None,
20
            inner: None,
21
        }
22
    };
23
}
24

25
unsafe impl Facet<'_> for std::path::Path {
26
    const SHAPE: &'static Shape = &const {
27
        Shape {
28
            id: Shape::id_of::<Self>(),
29
            layout: Shape::UNSIZED_LAYOUT,
NEW
30
            vtable: value_vtable!(std::path::Path, |f, _opts| write!(
×
UNCOV
31
                f,
×
32
                "{}",
33
                Self::SHAPE.type_identifier
×
34
            )),
35
            ty: Type::User(UserType::Opaque),
36
            def: Def::Scalar,
37
            type_identifier: "Path",
38
            type_params: &[],
39
            doc: &[],
40
            attributes: &[],
41
            type_tag: None,
42
            inner: None,
43
        }
44
    };
45
}
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