diff --git a/source/_posts/rust-macro.md b/source/_posts/rust-macro.md index 9d5ef0c..4f2f539 100644 --- a/source/_posts/rust-macro.md +++ b/source/_posts/rust-macro.md @@ -234,7 +234,8 @@ mod client; ```rust macro_rules! calculate { - (eval $e:expr store to $a:ident) => {{ + // 注意,expr类型描述后面可以接的内容限制 + (eval $e:expr, store to $a:ident) => {{ let $a = $e; }} } @@ -246,7 +247,7 @@ macro_rules! calculate { fn main() { let variable: usize = 0; calculate! { - eval (100 + 50) / (29 * 16) store to variable + eval (100 + 50) / (29 * 16), store to variable } } ```