网站首页 > 博客文章 正文
// first_macro.rs
use std::io::stdin;
// A convenient macro to read input as string into a buffer
macro_rules! scanline {
($x:expr) => ({
stdin().read_line(&mut $x).unwrap();
$x.trim();
});
() => ({
let mut s = String::new();
stdin().read_line(&mut s).unwrap();
s
});
}
fn main() {
let mut input = String::new();
scanline!(input);
println!("Hi {}",input);
let a = scanline!();
println!("Hi {}", a);
}
猜你喜欢
- 2024-09-11 Rust 写操作系统之Hello world (三)
- 2024-09-11 Rust: 如何用Panic打造健壮应用(rust zig)
- 2024-09-11 在 Linux 新版内核中的 Rust 初探,原来是这样的
- 2024-09-11 Rust 向量(Vec)(rust 向量化)
- 2024-09-11 Rust 入坑指南:鳞次栉比 | CSDN 博文精选
- 2024-09-11 利用 Rust 过程宏实现的 derive-with 库
- 2024-09-11 Rust 基础入门-错误处理和宏-错误处理
- 2024-09-11 Rust 基础入门-错误处理和宏-属性式宏&函数式宏
- 2024-09-11 Rust中巧用matches!宏(rust腐蚀免费版)
- 2024-09-11 Rust编程语言里的宏回调(rust宏数据)
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)