Add methods in SalsaField and SalsaStruct to get visibility of field

This commit is contained in:
Mihail Mihov 2022-08-31 22:58:56 +03:00
parent 657b85682b
commit 3542f2a1e7

View file

@ -96,6 +96,11 @@ impl<A: AllowedOptions> SalsaStruct<A> {
self.all_fields().map(|ef| ef.name()).collect()
}
/// Visibilities of all fields
pub(crate) fn all_field_vises(&self) -> Vec<&syn::Visibility> {
self.all_fields().map(|ef| ef.vis()).collect()
}
/// Names of getters of all fields
pub(crate) fn all_get_field_names(&self) -> Vec<&syn::Ident> {
self.all_fields().map(|ef| ef.get_name()).collect()
@ -406,6 +411,11 @@ impl SalsaField {
self.field.ident.as_ref().unwrap()
}
/// The visibility of this field.
pub(crate) fn vis(&self) -> &syn::Visibility {
&self.field.vis
}
/// The type of this field (all `SalsaField` instances are named).
pub(crate) fn ty(&self) -> &syn::Type {
&self.field.ty