@@ -16,31 +16,77 @@ mod native {
16
16
}
17
17
18
18
/// Prints an unsigned 32-bit int.
19
- pub fn print32 ( value : u32 ) {
19
+ fn print32 ( value : u32 ) {
20
20
unsafe { native:: debug_print32 ( value) }
21
21
}
22
22
23
23
/// Prints an unsigned 64-bit int.
24
- pub fn print64 ( value : u64 ) {
24
+ fn print64 ( value : u64 ) {
25
25
unsafe { native:: debug_print64 ( value) }
26
26
}
27
27
28
28
/// Prints the contents of a slice.
29
- pub fn print_mem ( slice : & [ u8 ] ) {
29
+ fn print_mem ( slice : & [ u8 ] ) {
30
30
unsafe { native:: debug_printMem ( slice. as_ptr ( ) as * const u32 , slice. len ( ) as u32 ) }
31
31
}
32
32
33
33
/// Prints the contents of a slice in hexadecimal format.
34
- pub fn print_mem_hex ( slice : & [ u8 ] ) {
34
+ fn print_mem_hex ( slice : & [ u8 ] ) {
35
35
unsafe { native:: debug_printMemHex ( slice. as_ptr ( ) as * const u32 , slice. len ( ) as u32 ) }
36
36
}
37
37
38
38
/// Prints the value of a storage key.
39
- pub fn print_storage ( key : & StorageKey ) {
39
+ fn print_storage ( key : & StorageKey ) {
40
40
unsafe { native:: debug_printStorage ( key. bytes . as_ptr ( ) as * const u32 ) }
41
41
}
42
42
43
43
/// Prints the value of a storage key in hexadecimal format.
44
- pub fn print_storage_hex ( key : & StorageKey ) {
44
+ fn print_storage_hex ( key : & StorageKey ) {
45
45
unsafe { native:: debug_printStorageHex ( key. bytes . as_ptr ( ) as * const u32 ) }
46
46
}
47
+
48
+ #[ macro_export]
49
+ macro_rules! print32 {
50
+ ( $e: expr) => {
51
+ #[ cfg( debug_assertions) ]
52
+ :: print32( $e)
53
+ } ;
54
+ }
55
+
56
+ #[ macro_export]
57
+ macro_rules! print64 {
58
+ ( $e: expr) => {
59
+ #[ cfg( debug_assertions) ]
60
+ :: print64( $e)
61
+ } ;
62
+ }
63
+
64
+ #[ macro_export]
65
+ macro_rules! print_mem {
66
+ ( $e: expr) => {
67
+ #[ cfg( debug_assertions) ]
68
+ :: print_mem( $e)
69
+ } ;
70
+ }
71
+
72
+ #[ macro_export]
73
+ macro_rules! print_mem_hex {
74
+ ( $e: expr) => {
75
+ #[ cfg( debug_assertions) ]
76
+ :: print_mem_hex( $e)
77
+ } ;
78
+ }
79
+ #[ macro_export]
80
+ macro_rules! print_storage {
81
+ ( $e: expr) => {
82
+ #[ cfg( debug_assertions) ]
83
+ :: print_storage( $e)
84
+ } ;
85
+ }
86
+ #[ macro_export]
87
+ macro_rules! print_storage_hex {
88
+ ( $e: expr) => {
89
+ #[ cfg( debug_assertions) ]
90
+ :: print_storage_hex( $e)
91
+ } ;
92
+ }
0 commit comments