1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
use syn::*; pub fn is_bool(ty: &Type) -> bool { if let Type::Path(TypePath { qself: None, path: Path { leading_colon: None, ref segments, }, }) = ty { // check for bool if segments.len() == 1 && segments.first().unwrap().ident == "bool" { return true; } } false }