I'm trying to write future-proof code that asserts matches!(field.mutability, FieldMutability::None) and reports a nice error if it isn't None:
let Field { mutability, .. } = &mut field;
if !matches!(mutability, FieldMutability::None) {
errors.push(syn::Error::new_spanned(mutability, "field mutability is not supported"));
*mutability = FieldMutability::None;
}
but that doesn't work because FieldMutability doesn't implement ToTokens.
Please add a ToTokens implementation. Adding a Parse implementation while you're at it would be nice.
I'm trying to write future-proof code that asserts
matches!(field.mutability, FieldMutability::None)
and reports a nice error if it isn'tNone
:but that doesn't work because
FieldMutability
doesn't implementToTokens
. Please add aToTokens
implementation. Adding aParse
implementation while you're at it would be nice.