@@ -20,7 +20,18 @@ impl Clone for Outer_Named {
2020 this
2121 }
2222}
23- impl ByteRepr for Outer_Named { }
23+ impl ByteRepr for Outer_Named {
24+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
25+ ( * self . a . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
26+ ( * self . b . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
27+ }
28+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
29+ Self {
30+ a : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
31+ b : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
32+ }
33+ }
34+ }
2435#[ derive( Default ) ]
2536pub struct Outer_anon_0 {
2637 pub c : Value < i32 > ,
@@ -35,7 +46,18 @@ impl Clone for Outer_anon_0 {
3546 this
3647 }
3748}
38- impl ByteRepr for Outer_anon_0 { }
49+ impl ByteRepr for Outer_anon_0 {
50+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
51+ ( * self . c . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
52+ ( * self . d . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
53+ }
54+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
55+ Self {
56+ c : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
57+ d : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
58+ }
59+ }
60+ }
3961#[ derive( Default ) ]
4062pub struct Outer_anon_1 {
4163 pub g : Value < i32 > ,
@@ -50,7 +72,18 @@ impl Clone for Outer_anon_1 {
5072 this
5173 }
5274}
53- impl ByteRepr for Outer_anon_1 { }
75+ impl ByteRepr for Outer_anon_1 {
76+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
77+ ( * self . g . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
78+ ( * self . h . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
79+ }
80+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
81+ Self {
82+ g : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
83+ h : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
84+ }
85+ }
86+ }
5487#[ derive( Default ) ]
5588pub struct Outer_anon_2 {
5689 pub e : Value < i32 > ,
@@ -65,7 +98,18 @@ impl Clone for Outer_anon_2 {
6598 this
6699 }
67100}
68- impl ByteRepr for Outer_anon_2 { }
101+ impl ByteRepr for Outer_anon_2 {
102+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
103+ ( * self . e . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
104+ ( * self . f . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
105+ }
106+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
107+ Self {
108+ e : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
109+ f : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
110+ }
111+ }
112+ }
69113#[ derive( Default ) ]
70114pub struct Outer_anon_3_anon_0 {
71115 pub j : Value < i32 > ,
@@ -78,7 +122,16 @@ impl Clone for Outer_anon_3_anon_0 {
78122 this
79123 }
80124}
81- impl ByteRepr for Outer_anon_3_anon_0 { }
125+ impl ByteRepr for Outer_anon_3_anon_0 {
126+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
127+ ( * self . j . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
128+ }
129+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
130+ Self {
131+ j : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
132+ }
133+ }
134+ }
82135#[ derive( Default ) ]
83136pub struct Outer_anon_3_anon_1 {
84137 pub k : Value < i32 > ,
@@ -91,7 +144,16 @@ impl Clone for Outer_anon_3_anon_1 {
91144 this
92145 }
93146}
94- impl ByteRepr for Outer_anon_3_anon_1 { }
147+ impl ByteRepr for Outer_anon_3_anon_1 {
148+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
149+ ( * self . k . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
150+ }
151+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
152+ Self {
153+ k : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
154+ }
155+ }
156+ }
95157#[ derive( Default ) ]
96158pub struct Outer_anon_3 {
97159 pub i : Value < i32 > ,
@@ -211,7 +273,18 @@ fn main_0() -> i32 {
211273 this
212274 }
213275 }
214- impl ByteRepr for anon_0 { } ;
276+ impl ByteRepr for anon_0 {
277+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
278+ ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
279+ ( * self . z . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
280+ }
281+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
282+ Self {
283+ x : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
284+ z : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
285+ }
286+ }
287+ } ;
215288 let s: Value < anon_0 > = Rc :: new ( RefCell :: new ( <anon_0 >:: default ( ) ) ) ;
216289 ( * ( * s. borrow ( ) ) . x . borrow_mut ( ) ) = 1 ;
217290 ( * ( * s. borrow ( ) ) . z . borrow_mut ( ) ) = 2 ;
0 commit comments