Skip to content

Commit f0b182d

Browse files
yew: function_component -> component (#3885)
1 parent 16fd8b0 commit f0b182d

File tree

102 files changed

+353
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+353
-350
lines changed

packages/yew-agent/src/oneshot/provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ where
8585
/// The Oneshot Agent Provider.
8686
///
8787
/// This component provides its children access to an oneshot agent.
88-
#[function_component]
88+
#[component]
8989
pub fn OneshotProvider<T, C = Bincode>(props: &WorkerProviderProps) -> Html
9090
where
9191
T: Oneshot + 'static,

packages/yew-agent/src/reactor/provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ where
8585
/// The Reactor Agent Provider.
8686
///
8787
/// This component provides its children access to a reactor agent.
88-
#[function_component]
88+
#[component]
8989
pub fn ReactorProvider<R, C = Bincode>(props: &WorkerProviderProps) -> Html
9090
where
9191
R: 'static + Reactor,

packages/yew-agent/src/worker/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//! # }
4040
//! # }
4141
//! use my_worker_mod::MyWorker; // note that <MyWorker as yew_agent::Worker>::Output == WorkerResponseType
42-
//! #[function_component(UseWorkerBridge)]
42+
//! #[component(UseWorkerBridge)]
4343
//! fn bridge() -> Html {
4444
//! let counter = use_state(|| 0);
4545
//!

packages/yew-agent/src/worker/provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ where
104104
/// The Worker Agent Provider.
105105
///
106106
/// This component provides its children access to a worker agent.
107-
#[function_component]
107+
#[component]
108108
pub fn WorkerProvider<W, C = Bincode>(props: &WorkerProviderProps) -> Html
109109
where
110110
W: Worker + 'static,

packages/yew-macro/src/function_component.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Parse for FunctionComponent {
3535
item => {
3636
return Err(syn::Error::new_spanned(
3737
item,
38-
"`function_component` attribute can only be applied to functions",
38+
"`component` attribute can only be applied to functions",
3939
))
4040
}
4141
};

packages/yew-macro/tests/derive_props/pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,12 @@ mod value_into_some_value_in_props {
258258
optional: ::std::option::Option<usize>
259259
}
260260

261-
#[::yew::function_component]
261+
#[::yew::component]
262262
fn Inner(_props: &Props) -> ::yew::html::Html {
263263
::yew::html!{}
264264
}
265265

266-
#[::yew::function_component]
266+
#[::yew::component]
267267
fn Main() -> ::yew::html::Html {
268268
::yew::html! {<>
269269
<Inner required=3 optional=5/>

packages/yew-macro/tests/function_component_attr/applied-to-non-fn-fail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct Props {
55
a: usize,
66
}
77

8-
#[function_component(Comp)]
8+
#[component(Comp)]
99
struct Test;
1010

1111
fn main() {}

packages/yew-macro/tests/function_component_attr/applied-to-non-fn-fail.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `function_component` attribute can only be applied to functions
1+
error: `component` attribute can only be applied to functions
22
--> $DIR/applied-to-non-fn-fail.rs:9:1
33
|
44
9 | struct Test;

packages/yew-macro/tests/function_component_attr/async-fail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct Props {
55
a: usize,
66
}
77

8-
#[function_component(Comp)]
8+
#[component(Comp)]
99
async fn comp(props: &Props) -> Html {
1010
html! {
1111
<p>

packages/yew-macro/tests/function_component_attr/bad-name-fail.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct Props {
55
a: usize,
66
}
77

8-
#[function_component(let)]
8+
#[component(let)]
99
fn comp(props: &Props) -> Html {
1010
html! {
1111
<p>
@@ -14,7 +14,7 @@ fn comp(props: &Props) -> Html {
1414
}
1515
}
1616

17-
#[function_component(x, y, z)]
17+
#[component(x, y, z)]
1818
fn comp_2(props: &Props) -> Html {
1919
html! {
2020
<p>
@@ -23,7 +23,7 @@ fn comp_2(props: &Props) -> Html {
2323
}
2424
}
2525

26-
#[function_component(124)]
26+
#[component(124)]
2727
fn comp_3(props: &Props) -> Html {
2828
html! {
2929
<p>
@@ -32,7 +32,7 @@ fn comp_3(props: &Props) -> Html {
3232
}
3333
}
3434

35-
#[function_component(component)]
35+
#[component(component)]
3636
fn component(props: &Props) -> Html {
3737
html! {
3838
<p>

0 commit comments

Comments
 (0)