Skip to content

Commit b377cb7

Browse files
put #[automatically_derived] on impls
they work on impls only, not blocks
1 parent 27d6982 commit b377cb7

File tree

7 files changed

+61
-8
lines changed

7 files changed

+61
-8
lines changed

tests/expand/borrow.expanded.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ struct Borrow<'a> {
55
raw: &'a str,
66
cow: Cow<'a, str>,
77
}
8-
#[automatically_derived]
98
const _: () = {
109
extern crate serde as _serde;
1110
use tsify_next::Tsify;
@@ -21,6 +20,7 @@ const _: () = {
2120
#[wasm_bindgen(typescript_type = "Borrow")]
2221
pub type JsType;
2322
}
23+
#[automatically_derived]
2424
impl<'a> Tsify for Borrow<'a> {
2525
type JsType = JsType;
2626
const DECL: &'static str = "export interface Borrow {\n raw: string;\n cow: string;\n}";
@@ -32,18 +32,21 @@ const _: () = {
3232
}
3333
#[wasm_bindgen(typescript_custom_section)]
3434
const TS_APPEND_CONTENT: &'static str = "export interface Borrow {\n raw: string;\n cow: string;\n}";
35+
#[automatically_derived]
3536
impl<'a> WasmDescribe for Borrow<'a> {
3637
#[inline]
3738
fn describe() {
3839
<Self as Tsify>::JsType::describe()
3940
}
4041
}
42+
#[automatically_derived]
4143
impl<'a> WasmDescribeVector for Borrow<'a> {
4244
#[inline]
4345
fn describe_vector() {
4446
<Self as Tsify>::JsType::describe_vector()
4547
}
4648
}
49+
#[automatically_derived]
4750
impl<'a> IntoWasmAbi for Borrow<'a>
4851
where
4952
Borrow<'a>: _serde::Serialize,
@@ -81,6 +84,7 @@ const _: () = {
8184
}
8285
}
8386
}
87+
#[automatically_derived]
8488
impl<'a> OptionIntoWasmAbi for Borrow<'a>
8589
where
8690
Borrow<'a>: _serde::Serialize,
@@ -90,6 +94,7 @@ const _: () = {
9094
<JsType as OptionIntoWasmAbi>::none()
9195
}
9296
}
97+
#[automatically_derived]
9398
impl<'a> From<Borrow<'a>> for JsValue
9499
where
95100
Borrow<'a>: _serde::Serialize,
@@ -126,6 +131,7 @@ const _: () = {
126131
}
127132
}
128133
}
134+
#[automatically_derived]
129135
impl<'a> VectorIntoWasmAbi for Borrow<'a>
130136
where
131137
Borrow<'a>: _serde::Serialize,
@@ -167,6 +173,7 @@ const _: () = {
167173
JsValue::vector_into_abi(values)
168174
}
169175
}
176+
#[automatically_derived]
170177
impl<'a> FromWasmAbi for Borrow<'a>
171178
where
172179
Self: _serde::de::DeserializeOwned,
@@ -181,6 +188,7 @@ const _: () = {
181188
result.unwrap_throw()
182189
}
183190
}
191+
#[automatically_derived]
184192
impl<'a> OptionFromWasmAbi for Borrow<'a>
185193
where
186194
Self: _serde::de::DeserializeOwned,
@@ -191,12 +199,14 @@ const _: () = {
191199
}
192200
}
193201
pub struct SelfOwner<T>(T);
202+
#[automatically_derived]
194203
impl<T> ::core::ops::Deref for SelfOwner<T> {
195204
type Target = T;
196205
fn deref(&self) -> &Self::Target {
197206
&self.0
198207
}
199208
}
209+
#[automatically_derived]
200210
impl<'a> RefFromWasmAbi for Borrow<'a>
201211
where
202212
Self: _serde::de::DeserializeOwned,
@@ -211,6 +221,7 @@ const _: () = {
211221
SelfOwner(result.unwrap_throw())
212222
}
213223
}
224+
#[automatically_derived]
214225
impl<'a> VectorFromWasmAbi for Borrow<'a>
215226
where
216227
Self: _serde::de::DeserializeOwned,

tests/expand/generic_enum.expanded.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub enum GenericEnum<T, U> {
66
Seq(T, U),
77
Map { x: T, y: U },
88
}
9-
#[automatically_derived]
109
const _: () = {
1110
extern crate serde as _serde;
1211
use tsify_next::Tsify;
@@ -22,6 +21,7 @@ const _: () = {
2221
#[wasm_bindgen(typescript_type = "GenericEnum")]
2322
pub type JsType;
2423
}
24+
#[automatically_derived]
2525
impl<T, U> Tsify for GenericEnum<T, U> {
2626
type JsType = JsType;
2727
const DECL: &'static str = "export type GenericEnum<T, U> = \"Unit\" | { NewType: T } | { Seq: [T, U] } | { Map: { x: T; y: U } };";
@@ -33,18 +33,21 @@ const _: () = {
3333
}
3434
#[wasm_bindgen(typescript_custom_section)]
3535
const TS_APPEND_CONTENT: &'static str = "export type GenericEnum<T, U> = \"Unit\" | { NewType: T } | { Seq: [T, U] } | { Map: { x: T; y: U } };";
36+
#[automatically_derived]
3637
impl<T, U> WasmDescribe for GenericEnum<T, U> {
3738
#[inline]
3839
fn describe() {
3940
<Self as Tsify>::JsType::describe()
4041
}
4142
}
43+
#[automatically_derived]
4244
impl<T, U> WasmDescribeVector for GenericEnum<T, U> {
4345
#[inline]
4446
fn describe_vector() {
4547
<Self as Tsify>::JsType::describe_vector()
4648
}
4749
}
50+
#[automatically_derived]
4851
impl<T, U> IntoWasmAbi for GenericEnum<T, U>
4952
where
5053
GenericEnum<T, U>: _serde::Serialize,
@@ -82,6 +85,7 @@ const _: () = {
8285
}
8386
}
8487
}
88+
#[automatically_derived]
8589
impl<T, U> OptionIntoWasmAbi for GenericEnum<T, U>
8690
where
8791
GenericEnum<T, U>: _serde::Serialize,
@@ -91,6 +95,7 @@ const _: () = {
9195
<JsType as OptionIntoWasmAbi>::none()
9296
}
9397
}
98+
#[automatically_derived]
9499
impl<T, U> From<GenericEnum<T, U>> for JsValue
95100
where
96101
GenericEnum<T, U>: _serde::Serialize,
@@ -127,6 +132,7 @@ const _: () = {
127132
}
128133
}
129134
}
135+
#[automatically_derived]
130136
impl<T, U> VectorIntoWasmAbi for GenericEnum<T, U>
131137
where
132138
GenericEnum<T, U>: _serde::Serialize,
@@ -168,6 +174,7 @@ const _: () = {
168174
JsValue::vector_into_abi(values)
169175
}
170176
}
177+
#[automatically_derived]
171178
impl<T, U> FromWasmAbi for GenericEnum<T, U>
172179
where
173180
Self: _serde::de::DeserializeOwned,
@@ -182,6 +189,7 @@ const _: () = {
182189
result.unwrap_throw()
183190
}
184191
}
192+
#[automatically_derived]
185193
impl<T, U> OptionFromWasmAbi for GenericEnum<T, U>
186194
where
187195
Self: _serde::de::DeserializeOwned,
@@ -192,12 +200,14 @@ const _: () = {
192200
}
193201
}
194202
pub struct SelfOwner<T>(T);
203+
#[automatically_derived]
195204
impl<T> ::core::ops::Deref for SelfOwner<T> {
196205
type Target = T;
197206
fn deref(&self) -> &Self::Target {
198207
&self.0
199208
}
200209
}
210+
#[automatically_derived]
201211
impl<T, U> RefFromWasmAbi for GenericEnum<T, U>
202212
where
203213
Self: _serde::de::DeserializeOwned,
@@ -212,6 +222,7 @@ const _: () = {
212222
SelfOwner(result.unwrap_throw())
213223
}
214224
}
225+
#[automatically_derived]
215226
impl<T, U> VectorFromWasmAbi for GenericEnum<T, U>
216227
where
217228
Self: _serde::de::DeserializeOwned,

0 commit comments

Comments
 (0)