derive_into/
util.rs

1pub(super) fn is_surrounding_type(ty: &syn::Type, surrounding_type: &'static str) -> bool {
2    if let syn::Type::Path(type_path) = ty {
3        if type_path.path.segments.len() == 1 {
4            let segment = &type_path.path.segments[0];
5            if segment.ident == surrounding_type {
6                return true;
7            }
8        }
9    }
10    false
11}