deny_public_fields/
lib.rs1use std::str::FromStr;
6
7use synstructure::{self, decl_derive};
8
9decl_derive!([DenyPublicFields] => deny_public_fields_derive);
10
11fn deny_public_fields_derive(s: synstructure::Structure) -> proc_macro::TokenStream {
12 s.each(|binding| {
13 if binding.ast().vis != syn::Visibility::Inherited {
14 panic!(
15 "Field `{}` should not be public",
16 binding.ast().ident.as_ref().unwrap_or(&binding.binding)
17 );
18 }
19
20 "".to_owned()
21 });
22
23 proc_macro::TokenStream::from_str("").unwrap()
24}