Fixed a few things

This commit is contained in:
2024-12-23 12:44:48 +01:00
parent d28bd2fdef
commit f6cf2be0ed
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "osui-element"
version = "0.1.22"
version = "0.1.23"
edition = "2021"
description = "The element attribute for defining elements in OSUI"
license = "Apache-2.0"
+3 -2
View File
@@ -90,7 +90,7 @@ pub fn element(_args: TokenStream, input: TokenStream) -> TokenStream {
}
#[proc_macro_attribute]
pub fn component(_args: TokenStream, input: TokenStream) -> TokenStream {
pub fn component(_: TokenStream, input: TokenStream) -> TokenStream {
let input_fn = parse_macro_input!(input as ItemFn);
let fn_name = input_fn.sig.ident.clone();
@@ -135,7 +135,8 @@ pub fn component(_args: TokenStream, input: TokenStream) -> TokenStream {
}
impl <#(#lifetimes),*> Component for #fn_name <#(#lifetimes),*> {
fn create_element(self) -> #return_type {
type Element = #return_type;
fn create_element(self) -> Self::Element {
#code
}
}
+3 -2
View File
@@ -2,8 +2,9 @@ use osui_element::component;
pub type Element = i32;
pub trait Component {
fn create_element(self) -> Element;
pub trait Component: std::fmt::Debug {
type Element;
fn create_element(self) -> Self::Element;
}
#[component]