'syn::ItemStruct not found on root

I am trying to use syn::ItemStruct, but the compiler it's telling me: no ItemStruct in the root.

I am using syn = "1.0.86", following this docs: https://docs.rs/syn/1.0.86/syn/struct.ItemStruct.html

Does anyone knows how to workaround this issue?

Minimal context:

fn parse(input: &ParseBuffer) -> syn::Result<Self> {
        let _struct = input.parse::<Struct>()?;

        let mut parsed_fields = Vec::new();

        for field in _struct.span.fields {
            let struct_attribute = StructField::try_from(&field)?;
                                            
            parsed_fields.push(struct_attribute);
        }
        ...
}

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source