Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_state/macros/src/lib.rs
6596 views
1
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
2
3
//! Macros for deriving `States` and `SubStates` traits.
4
5
extern crate proc_macro;
6
7
mod states;
8
9
use bevy_macro_utils::BevyManifest;
10
use proc_macro::TokenStream;
11
12
/// Implements the `States` trait for a type - see the trait
13
/// docs for an example usage.
14
#[proc_macro_derive(States, attributes(states))]
15
pub fn derive_states(input: TokenStream) -> TokenStream {
16
states::derive_states(input)
17
}
18
19
/// Implements the `SubStates` trait for a type - see the trait
20
/// docs for an example usage.
21
#[proc_macro_derive(SubStates, attributes(states, source))]
22
pub fn derive_substates(input: TokenStream) -> TokenStream {
23
states::derive_substates(input)
24
}
25
26
pub(crate) fn bevy_state_path() -> syn::Path {
27
BevyManifest::shared().get_path("bevy_state")
28
}
29
30