@@ -9,7 +9,7 @@ macro_rules! replace_expr {
9
9
10
10
#[ macro_export]
11
11
macro_rules! count_tts {
12
- ( $( $tts: tt) * ) => { 0usize $( + replace_expr!( $tts 1usize ) ) * } ;
12
+ ( $( $tts: tt) * ) => { 0usize $( + $crate :: replace_expr!( $tts 1usize ) ) * } ;
13
13
}
14
14
15
15
#[ macro_export]
@@ -45,14 +45,14 @@ macro_rules! arg_check {
45
45
}
46
46
} ;
47
47
( $vm: ident, $args: ident, required=[ $( ( $arg_name: ident, $arg_type: expr) ) ,* ] ) => {
48
- arg_check!( $vm, $args, required=[ $( ( $arg_name, $arg_type) ) ,* ] , optional=[ ] ) ;
48
+ $crate :: arg_check!( $vm, $args, required=[ $( ( $arg_name, $arg_type) ) ,* ] , optional=[ ] ) ;
49
49
} ;
50
50
( $vm: ident, $args: ident, required=[ $( ( $arg_name: ident, $arg_type: expr) ) ,* ] , optional=[ $( ( $optional_arg_name: ident, $optional_arg_type: expr) ) ,* ] ) => {
51
51
let mut arg_count = 0 ;
52
52
53
53
// use macro magic to compile-time count number of required and optional arguments
54
- let minimum_arg_count = count_tts!( $( $arg_name) * ) ;
55
- let maximum_arg_count = minimum_arg_count + count_tts!( $( $optional_arg_name) * ) ;
54
+ let minimum_arg_count = $crate :: count_tts!( $( $arg_name) * ) ;
55
+ let maximum_arg_count = minimum_arg_count + $crate :: count_tts!( $( $optional_arg_name) * ) ;
56
56
57
57
// verify that the number of given arguments is right
58
58
if $args. args. len( ) < minimum_arg_count || $args. args. len( ) > maximum_arg_count {
@@ -72,7 +72,7 @@ macro_rules! arg_check {
72
72
// check if the type matches. If not, return with error
73
73
// assign the arg to a variable
74
74
$(
75
- type_check!( $vm, $args, arg_count, $arg_name, $arg_type) ;
75
+ $crate :: type_check!( $vm, $args, arg_count, $arg_name, $arg_type) ;
76
76
let $arg_name = & $args. args[ arg_count] ;
77
77
#[ allow( unused_assignments) ]
78
78
{
@@ -85,7 +85,7 @@ macro_rules! arg_check {
85
85
// assign the arg to a variable
86
86
$(
87
87
let $optional_arg_name = if arg_count < $args. args. len( ) {
88
- type_check!( $vm, $args, arg_count, $optional_arg_name, $optional_arg_type) ;
88
+ $crate :: type_check!( $vm, $args, arg_count, $optional_arg_name, $optional_arg_type) ;
89
89
let ret = Some ( & $args. args[ arg_count] ) ;
90
90
#[ allow( unused_assignments) ]
91
91
{
@@ -226,7 +226,7 @@ macro_rules! match_class {
226
226
( $obj: expr, $binding: ident @ $class: ty => $expr: expr, $( $rest: tt) * ) => {
227
227
match $obj. downcast:: <$class>( ) {
228
228
Ok ( $binding) => $expr,
229
- Err ( _obj) => match_class!( _obj, $( $rest) * ) ,
229
+ Err ( _obj) => $crate :: match_class!( _obj, $( $rest) * ) ,
230
230
}
231
231
} ;
232
232
@@ -236,7 +236,7 @@ macro_rules! match_class {
236
236
if $obj. payload_is:: <$class>( ) {
237
237
$expr
238
238
} else {
239
- match_class!( $obj, $( $rest) * )
239
+ $crate :: match_class!( $obj, $( $rest) * )
240
240
}
241
241
} ;
242
242
}
0 commit comments