captcha_oxide_derive 4.0.0

Useful proc macros for captcha_oxide
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use syn::{token::Comma, Field};

pub fn extract_named_fields(
    fields: syn::Fields,
    span: proc_macro2::Span,
) -> deluxe::Result<syn::punctuated::Punctuated<Field, Comma>> {
    match fields {
        syn::Fields::Named(x) => Ok(x.named),
        _ => Err(syn::Error::new(
            span,
            "The CaptchaTask can only be derived by structs with named fields",
        )),
    }
}