Skip to content

Commit b78e10d

Browse files
jsuJSU
jsu
authored and
JSU
committed
Generated examples
1 parent 15d69c4 commit b78e10d

File tree

20 files changed

+192
-20
lines changed

20 files changed

+192
-20
lines changed

samples/rust_generated/my_game/sample/vec_3_generated.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,21 @@ impl<'a> Vec3 {
180180
}
181181
}
182182

183-
#[derive(Debug, Clone, PartialEq, Default)]
183+
#[derive(Debug, Copy, Clone, PartialEq)]
184184
pub struct Vec3T {
185185
pub x: f32,
186186
pub y: f32,
187187
pub z: f32,
188188
}
189+
impl std::default::Default for Vec3T {
190+
fn default() -> Self {
191+
Self {
192+
x: Default::default(),
193+
y: Default::default(),
194+
z: Default::default(),
195+
}
196+
}
197+
}
189198
impl Vec3T {
190199
pub fn pack(&self) -> Vec3 {
191200
Vec3::new(

tests/arrays_test/my_game/example/array_struct_generated.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl<'a> ArrayStruct {
240240
}
241241
}
242242

243-
#[derive(Debug, Clone, PartialEq, Default)]
243+
#[derive(Debug, Copy, Clone, PartialEq)]
244244
pub struct ArrayStructT {
245245
pub a: f32,
246246
pub b: [i32; 15],
@@ -249,6 +249,18 @@ pub struct ArrayStructT {
249249
pub e: i32,
250250
pub f: [i64; 2],
251251
}
252+
impl std::default::Default for ArrayStructT {
253+
fn default() -> Self {
254+
Self {
255+
a: Default::default(),
256+
b: [Default::default(); 15],
257+
c: Default::default(),
258+
d: [Default::default(); 2],
259+
e: Default::default(),
260+
f: [Default::default(); 2],
261+
}
262+
}
263+
}
252264
impl ArrayStructT {
253265
pub fn pack(&self) -> ArrayStruct {
254266
ArrayStruct::new(

tests/arrays_test/my_game/example/nested_struct_generated.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,23 @@ impl<'a> NestedStruct {
174174
}
175175
}
176176

177-
#[derive(Debug, Clone, PartialEq, Default)]
177+
#[derive(Debug, Copy, Clone, PartialEq)]
178178
pub struct NestedStructT {
179179
pub a: [i32; 2],
180180
pub b: TestEnum,
181181
pub c: [TestEnum; 2],
182182
pub d: [i64; 2],
183183
}
184+
impl std::default::Default for NestedStructT {
185+
fn default() -> Self {
186+
Self {
187+
a: [Default::default(); 2],
188+
b: Default::default(),
189+
c: [Default::default(); 2],
190+
d: [Default::default(); 2],
191+
}
192+
}
193+
}
184194
impl NestedStructT {
185195
pub fn pack(&self) -> NestedStruct {
186196
NestedStruct::new(

tests/include_test1/my_game/other_name_space/unused_generated.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,17 @@ impl<'a> Unused {
114114
}
115115
}
116116

117-
#[derive(Debug, Clone, PartialEq, Default)]
117+
#[derive(Debug, Copy, Clone, PartialEq)]
118118
pub struct UnusedT {
119119
pub a: i32,
120120
}
121+
impl std::default::Default for UnusedT {
122+
fn default() -> Self {
123+
Self {
124+
a: Default::default(),
125+
}
126+
}
127+
}
121128
impl UnusedT {
122129
pub fn pack(&self) -> Unused {
123130
Unused::new(

tests/include_test2/my_game/other_name_space/unused_generated.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,17 @@ impl<'a> Unused {
114114
}
115115
}
116116

117-
#[derive(Debug, Clone, PartialEq, Default)]
117+
#[derive(Debug, Copy, Clone, PartialEq)]
118118
pub struct UnusedT {
119119
pub a: i32,
120120
}
121+
impl std::default::Default for UnusedT {
122+
fn default() -> Self {
123+
Self {
124+
a: Default::default(),
125+
}
126+
}
127+
}
121128
impl UnusedT {
122129
pub fn pack(&self) -> Unused {
123130
Unused::new(

tests/monster_test/my_game/example/ability_generated.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,19 @@ impl<'a> Ability {
157157
}
158158
}
159159

160-
#[derive(Debug, Clone, PartialEq, Default)]
160+
#[derive(Debug, Copy, Clone, PartialEq)]
161161
pub struct AbilityT {
162162
pub id: u32,
163163
pub distance: u32,
164164
}
165+
impl std::default::Default for AbilityT {
166+
fn default() -> Self {
167+
Self {
168+
id: Default::default(),
169+
distance: Default::default(),
170+
}
171+
}
172+
}
165173
impl AbilityT {
166174
pub fn pack(&self) -> Ability {
167175
Ability::new(

tests/monster_test/my_game/example/struct_of_structs_generated.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,21 @@ impl<'a> StructOfStructs {
129129
}
130130
}
131131

132-
#[derive(Debug, Clone, PartialEq, Default)]
132+
#[derive(Debug, Copy, Clone, PartialEq)]
133133
pub struct StructOfStructsT {
134134
pub a: AbilityT,
135135
pub b: TestT,
136136
pub c: AbilityT,
137137
}
138+
impl std::default::Default for StructOfStructsT {
139+
fn default() -> Self {
140+
Self {
141+
a: Default::default(),
142+
b: Default::default(),
143+
c: Default::default(),
144+
}
145+
}
146+
}
138147
impl StructOfStructsT {
139148
pub fn pack(&self) -> StructOfStructs {
140149
StructOfStructs::new(

tests/monster_test/my_game/example/struct_of_structs_of_structs_generated.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,17 @@ impl<'a> StructOfStructsOfStructs {
9797
}
9898
}
9999

100-
#[derive(Debug, Clone, PartialEq, Default)]
100+
#[derive(Debug, Copy, Clone, PartialEq)]
101101
pub struct StructOfStructsOfStructsT {
102102
pub a: StructOfStructsT,
103103
}
104+
impl std::default::Default for StructOfStructsOfStructsT {
105+
fn default() -> Self {
106+
Self {
107+
a: Default::default(),
108+
}
109+
}
110+
}
104111
impl StructOfStructsOfStructsT {
105112
pub fn pack(&self) -> StructOfStructsOfStructs {
106113
StructOfStructsOfStructs::new(

tests/monster_test/my_game/example/test_generated.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,19 @@ impl<'a> Test {
147147
}
148148
}
149149

150-
#[derive(Debug, Clone, PartialEq, Default)]
150+
#[derive(Debug, Copy, Clone, PartialEq)]
151151
pub struct TestT {
152152
pub a: i16,
153153
pub b: i8,
154154
}
155+
impl std::default::Default for TestT {
156+
fn default() -> Self {
157+
Self {
158+
a: Default::default(),
159+
b: Default::default(),
160+
}
161+
}
162+
}
155163
impl TestT {
156164
pub fn pack(&self) -> Test {
157165
Test::new(

tests/monster_test/my_game/example/vec_3_generated.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<'a> Vec3 {
262262
}
263263
}
264264

265-
#[derive(Debug, Clone, PartialEq, Default)]
265+
#[derive(Debug, Copy, Clone, PartialEq)]
266266
pub struct Vec3T {
267267
pub x: f32,
268268
pub y: f32,
@@ -271,6 +271,18 @@ pub struct Vec3T {
271271
pub test2: Color,
272272
pub test3: TestT,
273273
}
274+
impl std::default::Default for Vec3T {
275+
fn default() -> Self {
276+
Self {
277+
x: Default::default(),
278+
y: Default::default(),
279+
z: Default::default(),
280+
test1: Default::default(),
281+
test2: Default::default(),
282+
test3: Default::default(),
283+
}
284+
}
285+
}
274286
impl Vec3T {
275287
pub fn pack(&self) -> Vec3 {
276288
Vec3::new(

tests/monster_test/my_game/other_name_space/unused_generated.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,17 @@ impl<'a> Unused {
114114
}
115115
}
116116

117-
#[derive(Debug, Clone, PartialEq, Default)]
117+
#[derive(Debug, Copy, Clone, PartialEq)]
118118
pub struct UnusedT {
119119
pub a: i32,
120120
}
121+
impl std::default::Default for UnusedT {
122+
fn default() -> Self {
123+
Self {
124+
a: Default::default(),
125+
}
126+
}
127+
}
121128
impl UnusedT {
122129
pub fn pack(&self) -> Unused {
123130
Unused::new(

tests/monster_test_serialize/my_game/example/ability_generated.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,19 @@ impl<'a> Ability {
171171
}
172172
}
173173

174-
#[derive(Debug, Clone, PartialEq, Default)]
174+
#[derive(Debug, Copy, Clone, PartialEq)]
175175
pub struct AbilityT {
176176
pub id: u32,
177177
pub distance: u32,
178178
}
179+
impl std::default::Default for AbilityT {
180+
fn default() -> Self {
181+
Self {
182+
id: Default::default(),
183+
distance: Default::default(),
184+
}
185+
}
186+
}
179187
impl AbilityT {
180188
pub fn pack(&self) -> Ability {
181189
Ability::new(

tests/monster_test_serialize/my_game/example/struct_of_structs_generated.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,21 @@ impl<'a> StructOfStructs {
144144
}
145145
}
146146

147-
#[derive(Debug, Clone, PartialEq, Default)]
147+
#[derive(Debug, Copy, Clone, PartialEq)]
148148
pub struct StructOfStructsT {
149149
pub a: AbilityT,
150150
pub b: TestT,
151151
pub c: AbilityT,
152152
}
153+
impl std::default::Default for StructOfStructsT {
154+
fn default() -> Self {
155+
Self {
156+
a: Default::default(),
157+
b: Default::default(),
158+
c: Default::default(),
159+
}
160+
}
161+
}
153162
impl StructOfStructsT {
154163
pub fn pack(&self) -> StructOfStructs {
155164
StructOfStructs::new(

tests/monster_test_serialize/my_game/example/struct_of_structs_of_structs_generated.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,17 @@ impl<'a> StructOfStructsOfStructs {
110110
}
111111
}
112112

113-
#[derive(Debug, Clone, PartialEq, Default)]
113+
#[derive(Debug, Copy, Clone, PartialEq)]
114114
pub struct StructOfStructsOfStructsT {
115115
pub a: StructOfStructsT,
116116
}
117+
impl std::default::Default for StructOfStructsOfStructsT {
118+
fn default() -> Self {
119+
Self {
120+
a: Default::default(),
121+
}
122+
}
123+
}
117124
impl StructOfStructsOfStructsT {
118125
pub fn pack(&self) -> StructOfStructsOfStructs {
119126
StructOfStructsOfStructs::new(

tests/monster_test_serialize/my_game/example/test_generated.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,19 @@ impl<'a> Test {
161161
}
162162
}
163163

164-
#[derive(Debug, Clone, PartialEq, Default)]
164+
#[derive(Debug, Copy, Clone, PartialEq)]
165165
pub struct TestT {
166166
pub a: i16,
167167
pub b: i8,
168168
}
169+
impl std::default::Default for TestT {
170+
fn default() -> Self {
171+
Self {
172+
a: Default::default(),
173+
b: Default::default(),
174+
}
175+
}
176+
}
169177
impl TestT {
170178
pub fn pack(&self) -> Test {
171179
Test::new(

tests/monster_test_serialize/my_game/example/vec_3_generated.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'a> Vec3 {
280280
}
281281
}
282282

283-
#[derive(Debug, Clone, PartialEq, Default)]
283+
#[derive(Debug, Copy, Clone, PartialEq)]
284284
pub struct Vec3T {
285285
pub x: f32,
286286
pub y: f32,
@@ -289,6 +289,18 @@ pub struct Vec3T {
289289
pub test2: Color,
290290
pub test3: TestT,
291291
}
292+
impl std::default::Default for Vec3T {
293+
fn default() -> Self {
294+
Self {
295+
x: Default::default(),
296+
y: Default::default(),
297+
z: Default::default(),
298+
test1: Default::default(),
299+
test2: Default::default(),
300+
test3: Default::default(),
301+
}
302+
}
303+
}
292304
impl Vec3T {
293305
pub fn pack(&self) -> Vec3 {
294306
Vec3::new(

tests/monster_test_serialize/my_game/other_name_space/unused_generated.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,17 @@ impl<'a> Unused {
127127
}
128128
}
129129

130-
#[derive(Debug, Clone, PartialEq, Default)]
130+
#[derive(Debug, Copy, Clone, PartialEq)]
131131
pub struct UnusedT {
132132
pub a: i32,
133133
}
134+
impl std::default::Default for UnusedT {
135+
fn default() -> Self {
136+
Self {
137+
a: Default::default(),
138+
}
139+
}
140+
}
134141
impl UnusedT {
135142
pub fn pack(&self) -> Unused {
136143
Unused::new(

tests/namespace_test/namespace_a/namespace_b/struct_in_nested_ns_generated.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,19 @@ impl<'a> StructInNestedNS {
147147
}
148148
}
149149

150-
#[derive(Debug, Clone, PartialEq, Default)]
150+
#[derive(Debug, Copy, Clone, PartialEq)]
151151
pub struct StructInNestedNST {
152152
pub a: i32,
153153
pub b: i32,
154154
}
155+
impl std::default::Default for StructInNestedNST {
156+
fn default() -> Self {
157+
Self {
158+
a: Default::default(),
159+
b: Default::default(),
160+
}
161+
}
162+
}
155163
impl StructInNestedNST {
156164
pub fn pack(&self) -> StructInNestedNS {
157165
StructInNestedNS::new(

0 commit comments

Comments
 (0)