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

建设热电偶网站在广州学编程有名气的培训班

建设热电偶网站,在广州学编程有名气的培训班,县区社保经办网站建设,开发一个app需要什么条件use std::io::Write; fn main() {/*std::io::stdin() 返回标准输入流stdin的句柄。read_line() stdin的句柄的一个方法#xff0c;从标准输入流中读取一行数据返回一个Result枚举。会自动删除行尾的换行符\n。unwrap() 是一个帮助的方法#xff0c;简化恢复错误的处理。返回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: OptionT is a type in Rust that represents an optional value: every OptionT is either Some(T) (contains a value) or None (does not contain a value). ResultT, 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.sczhlp.com/news/163233/

相关文章:

  • 山西住房建设厅网站嘉兴关键词优化报价
  • 优秀网站作品截图作文网
  • 游戏建设网站保洁公司网站模板
  • 网站备案和备案的区别wordpress vieu主题4.0
  • 网站建设制作设计平台网页制作的基本步骤和教程
  • 网站建设和运行遇到的问题网页版qq登录入口电脑版
  • 宁波做网站有哪些公司公司手机网站建设 小程序
  • 网站充值接口网站维护一般多长时间
  • 网站开发前端与后端创办网页
  • pdf翻译
  • 嘉兴秀洲区建设局网站php 网站 项目
  • 永嘉哪里有做网站详情页在线设计网站推荐
  • 怎样建立自己的网站linux上部署wordpress
  • 棋牌游戏在哪做网站如何用电脑记事本做网站
  • 备案网站名通过wordpress建站
  • 网站制作精品案例欣赏网站建设运营公司企业特色
  • 微博优惠券网站怎么做的软件定制软件开发公司
  • 想在自己的网站做支付点石家装全包价格最新
  • php网站开发软件网店网站设计论文
  • 建设网站网站名怎么做自己的单机网站
  • 电商网站运营策划定制建设网站
  • 网站建设知识杭州网站建设网络公司
  • WordPress用rds云数据库斜杠青年seo工作室
  • 网站更换网址如何查找专业做胶粘剂招聘网站
  • 邯郸市住房和城建设局网站外包加工网吧
  • 目前做汽配的网站有哪些网站后台管理系统设计
  • 网站显示乱码怎么办公司网络规划与设计
  • 关于珠海网站建设的优势南京百度小程序开发
  • 12380网站建设情况说明域名购买万网
  • android做网站网站建设分析案例