@@ -12,6 +12,9 @@ pub struct Named {
1212 pub b : Value < i32 > ,
1313}
1414impl ByteRepr for Named {
15+ fn byte_size ( ) -> usize {
16+ 8
17+ }
1518 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
1619 ( * self . a . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
1720 ( * self . b . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
@@ -29,6 +32,9 @@ pub struct anon_0 {
2932 pub d : Value < i32 > ,
3033}
3134impl ByteRepr for anon_0 {
35+ fn byte_size ( ) -> usize {
36+ 8
37+ }
3238 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
3339 ( * self . c . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
3440 ( * self . d . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
@@ -46,6 +52,9 @@ pub struct anon_1 {
4652 pub h : Value < i32 > ,
4753}
4854impl ByteRepr for anon_1 {
55+ fn byte_size ( ) -> usize {
56+ 8
57+ }
4958 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
5059 ( * self . g . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
5160 ( * self . h . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
@@ -63,6 +72,9 @@ pub struct anon_2 {
6372 pub f : Value < i32 > ,
6473}
6574impl ByteRepr for anon_2 {
75+ fn byte_size ( ) -> usize {
76+ 8
77+ }
6678 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
6779 ( * self . e . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
6880 ( * self . f . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
@@ -79,6 +91,9 @@ pub struct anon_4 {
7991 pub j : Value < i32 > ,
8092}
8193impl ByteRepr for anon_4 {
94+ fn byte_size ( ) -> usize {
95+ 4
96+ }
8297 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
8398 ( * self . j . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
8499 }
@@ -93,6 +108,9 @@ pub struct anon_5 {
93108 pub k : Value < i32 > ,
94109}
95110impl ByteRepr for anon_5 {
111+ fn byte_size ( ) -> usize {
112+ 4
113+ }
96114 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
97115 ( * self . k . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
98116 }
@@ -108,7 +126,23 @@ pub struct anon_3 {
108126 pub inner_named : Value < anon_4 > ,
109127 pub anon_5 : Value < anon_5 > ,
110128}
111- impl ByteRepr for anon_3 { }
129+ impl ByteRepr for anon_3 {
130+ fn byte_size ( ) -> usize {
131+ 12
132+ }
133+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
134+ ( * self . i . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
135+ ( * self . inner_named . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
136+ ( * self . anon_5 . borrow ( ) ) . to_bytes ( & mut buf[ 8 ..12 ] ) ;
137+ }
138+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
139+ Self {
140+ i : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
141+ inner_named : Rc :: new ( RefCell :: new ( <anon_4 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
142+ anon_5 : Rc :: new ( RefCell :: new ( <anon_5 >:: from_bytes ( & buf[ 8 ..12 ] ) ) ) ,
143+ }
144+ }
145+ }
112146#[ derive( Default ) ]
113147pub struct Outer {
114148 pub named : Value < Named > ,
@@ -117,7 +151,27 @@ pub struct Outer {
117151 pub anon_2 : Value < anon_2 > ,
118152 pub anon_3 : Value < anon_3 > ,
119153}
120- impl ByteRepr for Outer { }
154+ impl ByteRepr for Outer {
155+ fn byte_size ( ) -> usize {
156+ 44
157+ }
158+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
159+ ( * self . named . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..8 ] ) ;
160+ ( * self . anon0 . borrow ( ) ) . to_bytes ( & mut buf[ 8 ..16 ] ) ;
161+ ( * self . anon1 . borrow ( ) ) . to_bytes ( & mut buf[ 16 ..24 ] ) ;
162+ ( * self . anon_2 . borrow ( ) ) . to_bytes ( & mut buf[ 24 ..32 ] ) ;
163+ ( * self . anon_3 . borrow ( ) ) . to_bytes ( & mut buf[ 32 ..44 ] ) ;
164+ }
165+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
166+ Self {
167+ named : Rc :: new ( RefCell :: new ( <Named >:: from_bytes ( & buf[ 0 ..8 ] ) ) ) ,
168+ anon0 : Rc :: new ( RefCell :: new ( <anon_0 >:: from_bytes ( & buf[ 8 ..16 ] ) ) ) ,
169+ anon1 : Rc :: new ( RefCell :: new ( <anon_1 >:: from_bytes ( & buf[ 16 ..24 ] ) ) ) ,
170+ anon_2 : Rc :: new ( RefCell :: new ( <anon_2 >:: from_bytes ( & buf[ 24 ..32 ] ) ) ) ,
171+ anon_3 : Rc :: new ( RefCell :: new ( <anon_3 >:: from_bytes ( & buf[ 32 ..44 ] ) ) ) ,
172+ }
173+ }
174+ }
121175pub fn main ( ) {
122176 std:: process:: exit ( main_0 ( ) ) ;
123177}
@@ -176,6 +230,9 @@ fn main_0() -> i32 {
176230 pub z : Value < i32 > ,
177231 }
178232 impl ByteRepr for anon_6 {
233+ fn byte_size ( ) -> usize {
234+ 8
235+ }
179236 fn to_bytes ( & self , buf : & mut [ u8 ] ) {
180237 ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
181238 ( * self . z . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
0 commit comments