Make spans a bit better

This commit is contained in:
Michael Goulet
2023-05-03 23:53:44 +00:00
parent 2b9279f313
commit a156bd7714
7 changed files with 48 additions and 46 deletions

View File

@@ -207,6 +207,12 @@ impl<'ty> FieldInnerTy<'ty> {
FieldInnerTy::Plain(..) => quote! { #inner },
}
}
pub fn span(&self) -> proc_macro2::Span {
match self {
FieldInnerTy::Option(ty) | FieldInnerTy::Vec(ty) | FieldInnerTy::Plain(ty) => ty.span(),
}
}
}
/// Field information passed to the builder. Deliberately omits attrs to discourage the