@@ -20,17 +20,18 @@ macro_rules! syscall {
20
20
} ;
21
21
}
22
22
23
- /// Macro version of `syscall1`
23
+ /// Macro version of `syscall1`.
24
24
#[ macro_export]
25
25
macro_rules! syscall1 {
26
26
( $nr: ident, $a1: expr) => {
27
27
$crate:: syscall1( $crate:: nr:: $nr, $a1 as usize )
28
28
} ;
29
29
}
30
30
31
- /// Macro for printing to the HOST standard output
31
+ /// Macro for printing to the HOST standard output.
32
32
///
33
- /// This macro returns a `Result<(), ()>` value
33
+ /// This is similar to the `print!` macro in the standard library. Both will panic on any failure to
34
+ /// print.
34
35
#[ macro_export]
35
36
macro_rules! hprint {
36
37
( $s: expr) => {
@@ -43,7 +44,8 @@ macro_rules! hprint {
43
44
44
45
/// Macro for printing to the HOST standard output, with a newline.
45
46
///
46
- /// This macro returns a `Result<(), ()>` value
47
+ /// This is similar to the `println!` macro in the standard library. Both will panic on any failure to
48
+ /// print.
47
49
#[ macro_export]
48
50
macro_rules! hprintln {
49
51
( ) => {
@@ -57,9 +59,10 @@ macro_rules! hprintln {
57
59
} ;
58
60
}
59
61
60
- /// Macro for printing to the HOST standard error
62
+ /// Macro for printing to the HOST standard error.
61
63
///
62
- /// This macro returns a `Result<(), ()>` value
64
+ /// This is similar to the `eprint!` macro in the standard library. Both will panic on any failure
65
+ /// to print.
63
66
#[ macro_export]
64
67
macro_rules! heprint {
65
68
( $s: expr) => {
@@ -72,7 +75,8 @@ macro_rules! heprint {
72
75
73
76
/// Macro for printing to the HOST standard error, with a newline.
74
77
///
75
- /// This macro returns a `Result<(), ()>` value
78
+ /// This is similar to the `eprintln!` macro in the standard library. Both will panic on any failure
79
+ /// to print.
76
80
#[ macro_export]
77
81
macro_rules! heprintln {
78
82
( ) => {
@@ -86,22 +90,23 @@ macro_rules! heprintln {
86
90
} ;
87
91
}
88
92
89
- /// Macro that prints and returns the value of a given expression
90
- /// for quick and dirty debugging. Works exactly like `dbg!` in
91
- /// the standard library, replacing `eprintln` with `heprintln`,
92
- /// which it unwraps.
93
+ /// Macro that prints and returns the value of a given expression for quick and
94
+ /// dirty debugging.
95
+ ///
96
+ /// Works exactly like `dbg!` in the standard library, replacing `eprintln!`
97
+ /// with `heprintln!`.
93
98
#[ macro_export]
94
99
macro_rules! dbg {
95
100
( ) => {
96
- $crate:: heprintln!( "[{}:{}]" , file!( ) , line!( ) ) . unwrap ( ) ;
101
+ $crate:: heprintln!( "[{}:{}]" , file!( ) , line!( ) ) ;
97
102
} ;
98
103
( $val: expr) => {
99
104
// Use of `match` here is intentional because it affects the lifetimes
100
105
// of temporaries - https://stackoverflow.com/a/48732525/1063961
101
106
match $val {
102
107
tmp => {
103
108
$crate:: heprintln!( "[{}:{}] {} = {:#?}" ,
104
- file!( ) , line!( ) , stringify!( $val) , & tmp) . unwrap ( ) ;
109
+ file!( ) , line!( ) , stringify!( $val) , & tmp) ;
105
110
tmp
106
111
}
107
112
}
0 commit comments