Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support generic type parameters for component macro #33

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

ccbrown
Copy link
Owner

@ccbrown ccbrown commented Oct 31, 2024

What It Does

Adds support for generic type and const parameters for the component macro.

 #[derive(Props)]
 struct MyGenericProps<T, const U: usize> {
     foo: [T; U],
 }

 #[component]
 fn MyComponentWithGenericProps<T: 'static, const U: usize>(
     _props: &mut MyGenericProps<T, U>,
 ) -> impl Into<AnyElement<'static>> {
     element!(Box)
 }

 #[component]
 fn MyComponentWithGenericPropsWhereClause<T, const U: usize>(
     _props: &mut MyGenericProps<T, U>,
 ) -> impl Into<AnyElement<'static>>
 where
     T: 'static,
 {
     element!(Box)
 }

Related Issues

#32

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.14%. Comparing base (e412e99) to head (5a90fc3).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   90.99%   91.14%   +0.15%     
==========================================
  Files          23       23              
  Lines        3386     3445      +59     
  Branches     3386     3445      +59     
==========================================
+ Hits         3081     3140      +59     
  Misses        238      238              
  Partials       67       67              
Files with missing lines Coverage Δ
packages/iocraft-macros/src/lib.rs 95.72% <100.00%> (+0.50%) ⬆️

Impacted file tree graph

@ccbrown ccbrown merged commit 8b6d014 into main Oct 31, 2024
5 checks passed
@ccbrown ccbrown deleted the generic-component-macro-params branch October 31, 2024 04:02
@github-actions github-actions bot mentioned this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant