You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
926 B
Rust

use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
pub fn invoke(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let name = input.ident;
let expanded = quote! {
#[automatically_derived]
impl<B: crate::backend::Backend>
crate::view::__internal::CustomComponent<B> for #name
where
#name : crate::view::GetTemplate<B>
{}
#[automatically_derived]
impl<B: crate::backend::Backend>
crate::view::__internal::IntoNode<B> for #name
where
#name : crate::view::GetTemplate<B>
{
type Node = crate::view::__internal::CustomComponentWrapper<B, Self>;
fn into_node(self) -> Self::Node {
crate::view::__internal::CustomComponentWrapper::new(self)
}
}
};
expanded.into()
}