Skip to content

Commit

Permalink
release 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maccesch committed May 26, 2024
1 parent 093f858 commit 9af6095
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "leptos-struct-table-macro"
version = "0.10.0"
version = "0.11.0"
edition = "2021"
authors = ["Marc-Stefan Cassola"]
description = "Macros for the leptos-struct-table crate."
Expand Down
1 change: 0 additions & 1 deletion src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,3 @@ impl TableRowField {
class
}
}

33 changes: 10 additions & 23 deletions src/table_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ fn get_default_renderer_for_field_getter(
) -> TokenStream {
match get_inner_type(segment, "FieldGetter") {
Ok(type_ident) => get_default_renderer_for_type(
class_prop,
value_prop,
index_prop,
type_ident,
field,
getter,
class_prop, value_prop, index_prop, type_ident, field, getter,
),
Err(err) => err.to_compile_error(),
}
Expand Down Expand Up @@ -125,28 +120,20 @@ fn get_default_renderer_for_type(
getter: &TokenStream2,
) -> TokenStream {
if type_ident.to_string().starts_with("Option") {
get_default_option_renderer(
class_prop,
index_prop,
type_ident,
field,
getter,
)
get_default_option_renderer(class_prop, index_prop, type_ident, field, getter)
} else {
get_default_render_for_inner_type(
class_prop,
value_prop,
index_prop,
field,
type_ident,
)
get_default_render_for_inner_type(class_prop, value_prop, index_prop, field, type_ident)
}
}

fn get_format_props_for_field(field: &TableRowField, ty: &Ident) -> TokenStream2 {
let values : Vec<_> = field.format.iter().map(|(ident, value)| {
quote! {o.#ident = Some(#value.into());}
}).collect();
let values: Vec<_> = field
.format
.iter()
.map(|(ident, value)| {
quote! {o.#ident = Some(#value.into());}
})
.collect();

quote! {
{
Expand Down

0 comments on commit 9af6095

Please sign in to comment.