NamedField (src/fields.rs)

bevy · crates/bevy_reflect/src/fields.rs · rust · Apache-2.0
dev-tools, tag:knn-classified

Structs representing named and unnamed fields for Bevy's reflection system.

// Source: https://github.com/bevyengine/bevy | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
use crate::{
    attributes::{impl_custom_attribute_methods, CustomAttributes},
    ty::impl_type_methods,
    MaybeTyped, PartialReflect, Type, TypeInfo, TypePath,
};
use alloc::borrow::Cow;
use core::fmt::{Display, Formatter};

/// The named field of a reflected struct.
#[derive(Clone, Debug)]
pub struct NamedField {
    name: &'static str,
    type_info: fn() -> Option<&'static TypeInfo>,
    ty: Type,
    custom_attributes: CustomAttributes,
    #[cfg(feature = "reflect_documentation")]
    docs: Option<&'static str>,
}

impl NamedField {
    /// Create a new [`NamedField`].
    pub fn new<T: PartialReflect + MaybeTyped + TypePath>(name: &'static str) -> 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key