derive_extract_resource (src/lib.rs)

bevy · crates/bevy_extract/macros/src/lib.rs · rust · Apache-2.0
dev-tools, tag:knn-classified

Provides procedural macros to derive extraction traits for Bevy ECS components and resources.

#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
// Source: https://github.com/bevyengine/bevy | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
#![cfg_attr(docsrs, feature(doc_cfg))]

mod extract_component;
mod extract_resource;

use bevy_macro_utils::BevyManifest;
use proc_macro::TokenStream;

pub(crate) fn bevy_extract_path() -> syn::Path {
    BevyManifest::shared(|manifest| manifest.get_path("bevy_extract"))
}

#[proc_macro_derive(ExtractResource, attributes(extract_app))]
pub fn derive_extract_resource(input: TokenStream) -> TokenStream {
    extract_resource::derive_extract_resource(input)
}

/// Implements `ExtractComponent` trait for a component.
///
/// The component must implement [`Clone`].
/// The component will

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

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

Get a free API key