@@ -7,73 +7,73 @@ use std::io::{Read, Seek, Write};
77use std:: os:: fd:: AsFd ;
88use std:: rc:: { Rc , Weak } ;
99pub fn first_0 ( ) -> i32 {
10- #[ derive( Default ) ]
11- pub struct anon_1 {
12- pub x : Value < i32 > ,
13- pub y : Value < i32 > ,
14- }
15- impl Clone for anon_1 {
16- fn clone ( & self ) -> Self {
17- Self {
18- x : Rc :: new ( RefCell :: new ( ( * self . x . borrow ( ) ) . clone ( ) ) ) ,
19- y : Rc :: new ( RefCell :: new ( ( * self . y . borrow ( ) ) . clone ( ) ) ) ,
20- }
21- }
22- }
23- impl ByteRepr for anon_1 {
24- fn byte_size ( ) -> usize {
25- 8
26- }
27- fn to_bytes ( & self , buf : & mut [ u8 ] ) {
28- ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
29- ( * self . y . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
30- }
31- fn from_bytes ( buf : & [ u8 ] ) -> Self {
32- Self {
33- x : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
34- y : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
35- }
36- }
37- } ;
3810 let p: Value < anon_1 > = <Value < anon_1 > >:: default ( ) ;
3911 ( * ( * p. borrow ( ) ) . x . borrow_mut ( ) ) = 1 ;
4012 ( * ( * p. borrow ( ) ) . y . borrow_mut ( ) ) = 2 ;
4113 return ( ( * ( * p. borrow ( ) ) . x . borrow ( ) ) + ( * ( * p. borrow ( ) ) . y . borrow ( ) ) ) ;
4214}
43- pub fn second_2 ( ) -> i32 {
44- #[ derive( Default ) ]
45- pub struct anon_3 {
46- pub a : Value < i64 > ,
47- pub b : Value < i64 > ,
48- }
49- impl Clone for anon_3 {
50- fn clone ( & self ) -> Self {
51- Self {
52- a : Rc :: new ( RefCell :: new ( ( * self . a . borrow ( ) ) . clone ( ) ) ) ,
53- b : Rc :: new ( RefCell :: new ( ( * self . b . borrow ( ) ) . clone ( ) ) ) ,
54- }
15+ #[ derive( Default ) ]
16+ pub struct anon_1 {
17+ pub x : Value < i32 > ,
18+ pub y : Value < i32 > ,
19+ }
20+ impl Clone for anon_1 {
21+ fn clone ( & self ) -> Self {
22+ Self {
23+ x : Rc :: new ( RefCell :: new ( ( * self . x . borrow ( ) ) . clone ( ) ) ) ,
24+ y : Rc :: new ( RefCell :: new ( ( * self . y . borrow ( ) ) . clone ( ) ) ) ,
5525 }
5626 }
57- impl ByteRepr for anon_3 {
58- fn byte_size ( ) -> usize {
59- 16
60- }
61- fn to_bytes ( & self , buf : & mut [ u8 ] ) {
62- ( * self . a . borrow ( ) ) . to_bytes ( & mut buf[ 0 .. 8 ] ) ;
63- ( * self . b . borrow ( ) ) . to_bytes ( & mut buf[ 8 .. 16 ] ) ;
64- }
65- fn from_bytes ( buf : & [ u8 ] ) -> Self {
66- Self {
67- a : Rc :: new ( RefCell :: new ( < i64 > :: from_bytes ( & buf [ 0 .. 8 ] ) ) ) ,
68- b : Rc :: new ( RefCell :: new ( <i64 >:: from_bytes ( & buf[ 8 .. 16 ] ) ) ) ,
69- }
27+ }
28+ impl ByteRepr for anon_1 {
29+ fn byte_size ( ) -> usize {
30+ 8
31+ }
32+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
33+ ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 .. 4 ] ) ;
34+ ( * self . y . borrow ( ) ) . to_bytes ( & mut buf [ 4 .. 8 ] ) ;
35+ }
36+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
37+ Self {
38+ x : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 .. 4 ] ) ) ) ,
39+ y : Rc :: new ( RefCell :: new ( < i32 > :: from_bytes ( & buf [ 4 .. 8 ] ) ) ) ,
7040 }
71- } ;
41+ }
42+ }
43+ pub fn second_2 ( ) -> i32 {
7244 let q: Value < anon_3 > = <Value < anon_3 > >:: default ( ) ;
7345 ( * ( * q. borrow ( ) ) . a . borrow_mut ( ) ) = 10_i64 ;
7446 ( * ( * q. borrow ( ) ) . b . borrow_mut ( ) ) = 20_i64 ;
7547 return ( ( ( * ( * q. borrow ( ) ) . a . borrow ( ) ) + ( * ( * q. borrow ( ) ) . b . borrow ( ) ) ) as i32 ) ;
7648}
49+ #[ derive( Default ) ]
50+ pub struct anon_3 {
51+ pub a : Value < i64 > ,
52+ pub b : Value < i64 > ,
53+ }
54+ impl Clone for anon_3 {
55+ fn clone ( & self ) -> Self {
56+ Self {
57+ a : Rc :: new ( RefCell :: new ( ( * self . a . borrow ( ) ) . clone ( ) ) ) ,
58+ b : Rc :: new ( RefCell :: new ( ( * self . b . borrow ( ) ) . clone ( ) ) ) ,
59+ }
60+ }
61+ }
62+ impl ByteRepr for anon_3 {
63+ fn byte_size ( ) -> usize {
64+ 16
65+ }
66+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
67+ ( * self . a . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..8 ] ) ;
68+ ( * self . b . borrow ( ) ) . to_bytes ( & mut buf[ 8 ..16 ] ) ;
69+ }
70+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
71+ Self {
72+ a : Rc :: new ( RefCell :: new ( <i64 >:: from_bytes ( & buf[ 0 ..8 ] ) ) ) ,
73+ b : Rc :: new ( RefCell :: new ( <i64 >:: from_bytes ( & buf[ 8 ..16 ] ) ) ) ,
74+ }
75+ }
76+ }
7777pub fn main ( ) {
7878 std:: process:: exit ( main_0 ( ) ) ;
7979}
0 commit comments