1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! A crate providing [derive macros](https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros)
//! for [Crystal Ball](https://docs.rs/crystal_ball/).

extern crate proc_macro;

mod derive_transformable;

/// Easily implement [`Transformable`](https://docs.rs/crystal_ball/latest/crystal_ball/math/trait.Transformable.html).
///
/// The implementation simply multiplies the new transform with the old one.
///
/// # Attributes
/// - `#[transform]`: declares which field should be used for the implementation
/// - `#[internal]`: for use in `crystal_ball` itself only
///
/// # Examples
///
/// ```
/// use crystal_ball::math::Transform;
/// use crystal_ball::Transformable;
///
/// #[derive(Copy, Clone, Default, Debug, PartialEq, Transformable)]
/// pub struct Sphere {
///     #[transform]
///     pub transform: Transform,
/// }
/// ```
#[proc_macro_derive(Transformable, attributes(transform, internal))]
pub fn derive_transformable(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_transformable::derive_transformable(input)
}