Update example to show props deriving, text macro, etc
This commit is contained in:
parent
290b57d336
commit
241cae3c93
7 changed files with 50 additions and 24 deletions
|
|
@ -90,13 +90,13 @@ pub fn writable_props_derive(input: TokenStream) -> TokenStream {
|
|||
|
||||
TokenStream::from(quote! {
|
||||
impl #impl_generics #name #ty_generics #where_clause {
|
||||
fn default_props() -> #name_props {
|
||||
pub fn default_props() -> #name_props {
|
||||
#name_props::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl #impl_generics alchemy::ComponentProps for #name #ty_generics #where_clause {
|
||||
fn set_props(&mut self, new_props: &mut Any) {
|
||||
fn set_props(&mut self, new_props: &mut std::any::Any) {
|
||||
match new_props.downcast_ref::<#name_props>() {
|
||||
Some(props) => { },
|
||||
None => { panic!("Woah there, somehow the wrong props were being passed!"); }
|
||||
|
|
|
|||
Reference in a new issue