Skip to content

Commit

Permalink
Rename ReflectFieldAttr -> FieldAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGVSV committed Feb 8, 2024
1 parent b07cfcd commit 68c456c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::fmt;

use crate::container_attributes::{FromReflectAttrs, ReflectTraits, TypePathAttrs};
use crate::field_attributes::ReflectFieldAttr;
use crate::field_attributes::FieldAttributes;
use crate::type_path::parse_path_no_leading_colon;
use crate::utility::{StringExpr, WhereClauseOptions};
use quote::{quote, ToTokens};
Expand Down Expand Up @@ -95,7 +95,7 @@ pub(crate) struct StructField<'a> {
/// The raw field.
pub data: &'a Field,
/// The reflection-based attributes on the field.
pub attrs: ReflectFieldAttr,
pub attrs: FieldAttributes,
/// The index of this field within the struct.
pub declaration_index: usize,
/// The index of this field as seen by the reflection API.
Expand All @@ -118,7 +118,7 @@ pub(crate) struct EnumVariant<'a> {
pub fields: EnumVariantFields<'a>,
/// The reflection-based attributes on the variant.
#[allow(dead_code)]
pub attrs: ReflectFieldAttr,
pub attrs: FieldAttributes,
/// The index of this variant within the enum.
#[allow(dead_code)]
pub index: usize,
Expand Down Expand Up @@ -361,7 +361,7 @@ impl<'a> ReflectDerive<'a> {
.enumerate()
.map(
|(declaration_index, field)| -> Result<StructField, syn::Error> {
let attrs = ReflectFieldAttr::parse_attributes(&field.attrs)?;
let attrs = FieldAttributes::parse_attributes(&field.attrs)?;

let reflection_index = if attrs.ignore.is_ignored() {
None
Expand Down Expand Up @@ -404,7 +404,7 @@ impl<'a> ReflectDerive<'a> {
};
Ok(EnumVariant {
fields,
attrs: ReflectFieldAttr::parse_attributes(&variant.attrs)?,
attrs: FieldAttributes::parse_attributes(&variant.attrs)?,
data: variant,
index,
#[cfg(feature = "documentation")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ pub(crate) enum DefaultBehavior {

/// A container for attributes defined on a reflected type's field.
#[derive(Default, Clone)]
pub(crate) struct ReflectFieldAttr {
pub(crate) struct FieldAttributes {
/// Determines how this field should be ignored if at all.
pub ignore: ReflectIgnoreBehavior,
/// Sets the default behavior of this field.
pub default: DefaultBehavior,
}

impl ReflectFieldAttr {
impl FieldAttributes {
/// Parse all field attributes marked "reflect" (such as `#[reflect(ignore)]`).
pub fn parse_attributes(attrs: &[Attribute]) -> syn::Result<Self> {
let mut args = ReflectFieldAttr::default();
let mut args = FieldAttributes::default();

attrs
.iter()
Expand Down

0 comments on commit 68c456c

Please sign in to comment.