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

Alorel / delegate-display-rs / 11355618640

15 Oct 2024 10:51PM UTC coverage: 93.118%. Remained the same
11355618640

push

github

Alorel
feat: Support deriving multiple traits at once

BREAKING CHANGE: `dboth` attribute renamed to `dany`

81 of 85 new or added lines in 6 files covered. (95.29%)

9 existing lines in 1 file now uncovered.

433 of 465 relevant lines covered (93.12%)

8.8 hits per line

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

100.0
/src/implementation/variant.rs
1
use super::main_field::MainField;
2
use proc_macro2::Ident;
3
use syn::spanned::Spanned;
4

5
#[derive(Copy, Clone)]
6
pub(crate) enum Style {
7
    Named,
8
    Tuple,
9
    Unit,
10
}
11

12
pub(crate) struct Variant {
13
    pub ident: Ident,
14
    pub style: Style,
15
    pub main_field: Option<MainField>,
16
}
17

18
impl Variant {
19
    pub fn from_syn(variant: syn::Variant, attr_name: &str) -> syn::Result<Self> {
11✔
20
        let (style, main_field) = match variant.fields {
11✔
21
            syn::Fields::Named(f) => {
4✔
22
                let span = f.span();
4✔
23
                (
4✔
24
                    Style::Named,
4✔
25
                    MainField::resolve_from_iter(f.named, attr_name, span)?,
4✔
26
                )
27
            }
28
            syn::Fields::Unnamed(f) => {
5✔
29
                let span = f.span();
5✔
30
                (
5✔
31
                    Style::Tuple,
5✔
32
                    MainField::resolve_from_iter(f.unnamed, attr_name, span)?,
5✔
33
                )
34
            }
35
            syn::Fields::Unit => (Style::Unit, None),
2✔
36
        };
37

38
        Ok(Self {
10✔
39
            ident: variant.ident,
10✔
40
            style,
10✔
41
            main_field,
10✔
42
        })
10✔
43
    }
11✔
44
}
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