From 5329767b0e8cc8351ed982c2850068462488f0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 18 Mar 2022 16:04:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=AD=A3=E4=B8=80=E5=A4=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/_posts/rust-macro.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 } } ```