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
807 B
Rust
32 lines
807 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::Node<B> for #name
|
|
where
|
|
#name : crate::backend::Render<B>,
|
|
{}
|
|
|
|
#[automatically_derived]
|
|
impl<B: crate::backend::Backend>
|
|
crate::view::__internal::IntoNode<B> for #name
|
|
where
|
|
#name : crate::backend::Render<B>,
|
|
{
|
|
type Node = Self;
|
|
|
|
fn into_node(self) -> Self::Node {
|
|
self
|
|
}
|
|
}
|
|
};
|
|
expanded.into()
|
|
}
|