Skip to content

Commit 040d19f

Browse files
author
JSU
committed
Generated examples
1 parent c5e5837 commit 040d19f

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(

0 commit comments

Comments
 (0)