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

Alorel / delegate-display-rs / 11550909325

28 Oct 2024 09:19AM UTC coverage: 93.118%. First build
11550909325

Pull #13

github

web-flow
Merge 90c44bead into e44b91622
Pull Request #13: deps: bump alorel-actions/cargo from 1 to 2

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

90.0
/src/implementation/compound.rs
1
use super::opts::MultiContainerOptions;
2
use super::Implementation;
3
use crate::ATTR_FMT;
4
use macroific::prelude::*;
5
use proc_macro::TokenStream as TokenStream1;
6
use proc_macro2::{Span, TokenStream};
7
use syn::{DeriveInput, Error};
8

9
#[derive(Copy, Clone)]
10
pub struct Alias<'a> {
11
    pub attr_name: &'a str,
12
    pub trait_name: &'a str,
13
}
14

15
impl<'a> Implementation<'a> {
16
    pub fn exec_compound(input: TokenStream1) -> TokenStream1 {
1✔
17
        Self::exec_compound_2(input)
1✔
18
            .unwrap_or_else(Error::into_compile_error)
1✔
19
            .into()
1✔
20
    }
1✔
21

22
    fn exec_compound_2(input: TokenStream1) -> syn::Result<TokenStream> {
1✔
23
        let DeriveInput {
24
            attrs,
1✔
25
            ident,
1✔
26
            generics,
1✔
27
            data,
1✔
28
            ..
29
        } = syn::parse(input)?;
1✔
30

31
        let tokens = MultiContainerOptions::from_iter_named(ATTR_FMT, Span::call_site(), attrs)?
1✔
32
            .into_iter()
1✔
33
            .map(move |(alias, opts)| -> syn::Result<TokenStream> {
3✔
34
                let for_alias = Self {
3✔
35
                    opts,
3✔
36
                    trait_name: alias.trait_name,
3✔
37
                    ident: ident.clone(),
3✔
38
                    generics: generics.clone(),
3✔
39
                };
3✔
40

3✔
41
                for_alias.exec_data(data.clone(), alias.attr_name)
3✔
42
            })
3✔
43
            .collect::<syn::Result<TokenStream>>()?;
1✔
44

45
        if tokens.is_empty() {
1✔
46
            Err(Error::call_site(format!(
×
47
                "Missing #[{ATTR_FMT}] attribute."
×
48
            )))
×
49
        } else {
50
            Ok(tokens)
1✔
51
        }
52
    }
1✔
53
}
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