updated component

This commit is contained in:
2024-12-23 00:28:14 +01:00
parent 8550b5f6ff
commit 2d0668955e
3 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "osui-element" name = "osui-element"
version = "0.1.15" version = "0.1.16"
edition = "2021" edition = "2021"
description = "The element attribute for defining elements in OSUI" description = "The element attribute for defining elements in OSUI"
license = "Apache-2.0" license = "Apache-2.0"
+3 -3
View File
@@ -141,14 +141,14 @@ pub fn component(_args: TokenStream, input: TokenStream) -> TokenStream {
}); });
let expanded = quote! { let expanded = quote! {
#[derive(Debug)] #[derive(Debug, Default)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#visibility struct #fn_name { #visibility struct #fn_name {
#(#struct_fields),* #(#struct_fields),*
} }
impl #fn_name { impl Component for #fn_name {
pub fn create_element(&self) -> #return_type { fn create_element(&self) -> #return_type {
#code #code
} }
} }
+13
View File
@@ -1 +1,14 @@
use osui_element::component;
type Element = i32;
pub trait Component: std::fmt::Debug {
fn create_element(&self) -> Element;
}
#[component]
fn testing() {
20
}
fn main() {} fn main() {}