Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI
Commits
88eaec1c
Commit
88eaec1c
authored
3 years ago
by
MrGVSV
Browse files
Options
Downloads
Patches
Plain Diff
Forwarded attributes on functional widgets
parent
c2494886
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kayak_render_macros/examples/main.rs
+2
-0
2 additions, 0 deletions
kayak_render_macros/examples/main.rs
kayak_render_macros/src/function_component.rs
+2
-0
2 additions, 0 deletions
kayak_render_macros/src/function_component.rs
with
4 additions
and
0 deletions
kayak_render_macros/examples/main.rs
+
2
−
0
View file @
88eaec1c
...
@@ -5,6 +5,7 @@ use kayak_render_macros::{rsx, use_state, widget, WidgetProps};
...
@@ -5,6 +5,7 @@ use kayak_render_macros::{rsx, use_state, widget, WidgetProps};
#[derive(WidgetProps,
Clone,
Default,
Debug,
PartialEq)]
#[derive(WidgetProps,
Clone,
Default,
Debug,
PartialEq)]
#[allow(dead_code)]
#[allow(dead_code)]
struct
TestProps
{
struct
TestProps
{
/// A test prop
foo
:
u32
,
foo
:
u32
,
#[prop_field(Styles)]
#[prop_field(Styles)]
styles
:
Option
<
Style
>
,
styles
:
Option
<
Style
>
,
...
@@ -14,6 +15,7 @@ struct TestProps {
...
@@ -14,6 +15,7 @@ struct TestProps {
on_event
:
Option
<
kayak_core
::
OnEvent
>
,
on_event
:
Option
<
kayak_core
::
OnEvent
>
,
}
}
/// A test widget
#[widget]
#[widget]
fn
Test
(
props
:
TestProps
)
{
fn
Test
(
props
:
TestProps
)
{
let
_
=
use_state!
(
props
.foo
);
let
_
=
use_state!
(
props
.foo
);
...
...
This diff is collapsed.
Click to expand it.
kayak_render_macros/src/function_component.rs
+
2
−
0
View file @
88eaec1c
...
@@ -28,12 +28,14 @@ pub fn create_function_widget(f: syn::ItemFn, _widget_arguments: WidgetArguments
...
@@ -28,12 +28,14 @@ pub fn create_function_widget(f: syn::ItemFn, _widget_arguments: WidgetArguments
return
TokenStream
::
new
();
return
TokenStream
::
new
();
};
};
let
attrs
=
f
.attrs
;
let
block
=
f
.block
;
let
block
=
f
.block
;
let
vis
=
f
.vis
;
let
vis
=
f
.vis
;
let
kayak_core
=
get_core_crate
();
let
kayak_core
=
get_core_crate
();
TokenStream
::
from
(
quote!
{
TokenStream
::
from
(
quote!
{
#
(
#
attrs
)
*
#[derive(Default,
Debug,
PartialEq,
Clone)]
#[derive(Default,
Debug,
PartialEq,
Clone)]
#
vis
struct
#
struct_name
#
impl_generics
{
#
vis
struct
#
struct_name
#
impl_generics
{
pub
id
:
#
kayak_core
::
Index
,
pub
id
:
#
kayak_core
::
Index
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment