当前位置: 首页 > news >正文

腾讯云服务器centos做静态网站惠州seo关键词推广

腾讯云服务器centos做静态网站,惠州seo关键词推广,兼职网站编辑怎么做,设计制作建筑模型综合实践教案use std::io::Write; fn main() {/*std::io::stdin() 返回标准输入流stdin的句柄。read_line() stdin的句柄的一个方法,从标准输入流中读取一行数据返回一个Result枚举。会自动删除行尾的换行符\n。unwrap() 是一个帮助的方法,简化恢复错误的处理。返回R…
use std::io::Write;
fn main() {/*std::io::stdin() 返回标准输入流stdin的句柄。read_line() stdin的句柄的一个方法,从标准输入流中读取一行数据返回一个Result枚举。会自动删除行尾的换行符\n。unwrap() 是一个帮助的方法,简化恢复错误的处理。返回Result中的存储实际值。*/let mut in_word = String::new();let result = std::io::stdin().read_line(&mut in_word).unwrap();println!("您输入的是:{}\n", in_word);       // 您输入的是:helloprintln!("读取的字节数为:{}\n", result);    // 读取的字节数为:7let result1 = std::io::stdout().write("Rust".as_bytes()).unwrap();println!("写入的字节数为:{}\n", result1);   // Rust写入的字节数为:4let result2 = std::io::stdout().write("Hello".as_bytes()).unwrap();println!("写入的字节数为:{}\n", result2);   // Hello写入的字节数为:5/*std::io::stdout()返回标准输出流的句柄。write()是标准输出流stdout的句柄上的一个方法,用于向标准输出流中写入字节流的内容。也放回一个Result枚举,不会输出结束时自动追加换行符\n*/let input_args = std::env::args();for arg in input_args {println!("命令行参数:{}", arg);}/*输出:命令行参数:D:\Rust\io_23\target\debug\io_23.exe命令行参数:Rust命令行参数:Programming命令行参数:Language*/
}

unwrap()

In Rust, the unwrap() method is a common way to handle error states represented by the Option and Result types.

Let’s break it down a bit:

  • Option<T> is a type in Rust that represents an optional value: every Option<T> is either Some(T) (contains a value) or None (does not contain a value).

  • Result<T, E> is a type in Rust that can represent either success (Ok(T)) or failure (Err(E)).

Both Option and Result types have the method unwrap(). For an Option, calling unwrap() returns the contained value if it’s Some(T), but if it’s None, it will cause the program to panic (crash).

For a Result, calling unwrap() returns the contained value if it’s Ok(T), but if it’s Err(E), it will also cause the program to panic.

So, the unwrap() method is a somewhat risky operation to use, because while it’s a quick and easy way to obtain the inner value, it can cause your program to crash if the Option is None or the Result is an Err. In production code, it’s often preferable to handle errors more gracefully rather than using unwrap().

http://www.hkea.cn/news/807902/

相关文章:

  • 快速做网站优化谷歌在线浏览入口
  • 苏州企业网站建设开发与制作2023年6月份又封城了
  • 用java做网站可以吗吉林seo刷关键词排名优化
  • 网站建设面试google广告投放技巧
  • 整形网站整站源码如何让关键词排名靠前
  • php网站后台搭建外贸网站大全
  • 建 新闻 网站营销战略有哪些内容
  • 营销融合app网站seo招聘
  • 快速做网站的方法网站换了域名怎么查
  • 建筑工程网络计划图怎么编制百度seo搜索排名
  • 免费建网站系统百度云登陆首页
  • wordpress 采集微博网站建设优化
  • 做淘宝客新增网站推广百度用户服务中心人工电话
  • 域名备案网站建设书模板百度统计登录
  • 禁止WordPress访问官网优化关键词排名提升
  • 爬取漫画数据做网站今日热搜新闻头条
  • 雄安网站建设制作网站关键词如何快速上首页
  • 佛山从事网站建设百度小程序入口官网
  • 自建网站平台可以实现哪些功能网络营销这个专业怎么样
  • 佛山新网站制作公司网页制作成品模板网站
  • 校园网站建设的意见企业管理培训课程网课
  • 郑大远程教育动态网站建设seo优化关键词排名
  • 做logo什么网站昆明百度关键词优化
  • 怎样做省钱购物网站sem推广代运营
  • 英文网站开发公司万网阿里云域名查询
  • 做调查问卷网挣钱的网站新闻 今天
  • 网站建设工作小组在线建站平台免费建网站
  • 可以发广告的网站湖南seo推广系统
  • 大丰网站建设哪家好成都seo
  • 学校网站建设项目的wbsseo交流qq群