Rust 程序设计语言 简体中文版 1.85.0{x}"); 4 | x = 6; | ^^^^^ cannot assign twice to immutable variable | help: consider making this binding mutable | 2 | let mut x = 5; | +++ For more information about this e 只能用于结构体和枚举;属 性还可以用于其它的项,比如函数。作为一个使用类属性宏的例子,可以创建一个名为 route 的属性用于注解 web 应用程序框架(web application framework)的函数: #[route(GET, "/")] fn index() { #[route] 属性将由框架本身定义为一个过程宏。其宏定义的函数签名看起来像这样: #[proc_macro_attribute]0 码力 | 562 页 | 3.23 MB | 24 天前3
共 1 条
- 1













