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

做视频特效的网站有哪些安卓aso优化工具

做视频特效的网站有哪些,安卓aso优化工具,大气的公司名称大全,wordpress javascript广告插件文章目录 简介错误匹配 Rust基础教程: 初步⚙ 所有权⚙ 结构体和枚举类⚙ 函数进阶⚙ 泛型和特征⚙ 并发和线程通信⚙ cargo包管理⚙ 可空类型Option Rust进阶教程: 用宏实现参数可变的函数⚙ 类函数宏 简介 Rust中没有提供类似try…catch之类…

文章目录

    • 简介
    • 错误匹配

Rust基础教程: 初步⚙ 所有权⚙ 结构体和枚举类⚙ 函数进阶⚙ 泛型和特征⚙ 并发和线程通信⚙ cargo包管理⚙ 可空类型Option
Rust进阶教程: 用宏实现参数可变的函数⚙ 类函数宏

简介

Rust中没有提供类似try…catch之类的分支语句块,而是提供了Result这种数据类型,用于处理错误的返回值。和Option类似,Result的实质也是一种枚举类型

enum Result<T, E> {Ok(T),Err(E),
}

下面做一个简单的示例,用Result类型的返回值,来构造一个除法函数,并表示x/0这种问题

// res.rs
fn div_err(x:f32, y:f32) -> Result<f32, String>{if y==0.0{ Err("DIV BY ZERO".to_string()) } else{ Ok(x/y) }
}fn main(){println!("5/3={:?}", div_err(5.0,3.0));println!("5/0={:?}", div_err(5.0,0.0));
}

运行结果如下

>res.exe
5/3=Ok(1.6666666)
5/0=Err("DIV BY ZERO")

Rust有一个值得注意的性质,即未处理的Result,会在编译时提出警告,比如把main函数改成下面的形式,那么编译时会给出Result必须被使用的警告。

fn main(){div_err(5.0,3.0);
}

错误匹配

考虑到Result的本质是枚举类型,所以其常规的处理方式,也就是使用match匹配,相应地,Result也支持un_wrap方法,当Result的返回值是Err时输出直接报错。但另一方面,Result支持多种错误的设置,所以从报错的角度来说,功能显然是更全面的。

仍以除法为例,尽管除数为0时一定要报错,但形如 x / 0 x/0 x/0 0 / 0 0/0 0/0显然是两种不同的错误。如果为实数添加一个无穷大,那么实数域就可以映射到一个圆形上面,从而 x / 0 x/0 x/0就可以等于 ∞ \infty ,但 0 / 0 0/0 0/0仍然是错的。

下面就针对这两种不同的情况,为其设置错误。

fn div_err(x:f32, y:f32) -> Result<f32, String>{if y==0.0{if x==0.0{ Err("DIV ERROR".to_string())}else { Err("INF ERROR".to_string()) }} else{Ok(x/y)}
}fn div_print(x:f32, y:f32){match div_err(x, y){Ok(res) => println!("{}/{}={}", y, x, res),Err(res) => println!("{}", res)}
}fn main(){div_print(5.0, 3.0);div_print(5.0, 0.0);div_print(0.0, 0.0);
}

运行结果如下

>res.exe
3/5=1.6666666
INF ERROR
DIV ERROR

在这里插入图片描述


文章转载自:
http://subscapular.sqLh.cn
http://lingcod.sqLh.cn
http://jiffy.sqLh.cn
http://territorian.sqLh.cn
http://anonymously.sqLh.cn
http://coleopteron.sqLh.cn
http://lixivium.sqLh.cn
http://garbanzo.sqLh.cn
http://key.sqLh.cn
http://suedette.sqLh.cn
http://shekarry.sqLh.cn
http://gauge.sqLh.cn
http://extinguisher.sqLh.cn
http://physiotherapy.sqLh.cn
http://berkshire.sqLh.cn
http://cased.sqLh.cn
http://exteriorise.sqLh.cn
http://bicameral.sqLh.cn
http://postmitotic.sqLh.cn
http://sangreal.sqLh.cn
http://absorbency.sqLh.cn
http://maxisingle.sqLh.cn
http://adcraft.sqLh.cn
http://blanquism.sqLh.cn
http://ti.sqLh.cn
http://macau.sqLh.cn
http://impersonalise.sqLh.cn
http://blanket.sqLh.cn
http://gasometer.sqLh.cn
http://occasion.sqLh.cn
http://gynaeolatry.sqLh.cn
http://sdlc.sqLh.cn
http://eyespot.sqLh.cn
http://biker.sqLh.cn
http://binocle.sqLh.cn
http://reputably.sqLh.cn
http://tobacconist.sqLh.cn
http://pourable.sqLh.cn
http://anethole.sqLh.cn
http://ancestry.sqLh.cn
http://armistice.sqLh.cn
http://therma.sqLh.cn
http://chapleted.sqLh.cn
http://indecipherable.sqLh.cn
http://neandertal.sqLh.cn
http://ramdac.sqLh.cn
http://turbo.sqLh.cn
http://quebrada.sqLh.cn
http://rewardless.sqLh.cn
http://autography.sqLh.cn
http://peloponnesus.sqLh.cn
http://interlay.sqLh.cn
http://maghrib.sqLh.cn
http://bartend.sqLh.cn
http://octachord.sqLh.cn
http://determiner.sqLh.cn
http://illegitimation.sqLh.cn
http://driveller.sqLh.cn
http://cusso.sqLh.cn
http://daftly.sqLh.cn
http://stubbly.sqLh.cn
http://dicky.sqLh.cn
http://mesityl.sqLh.cn
http://anachronic.sqLh.cn
http://androcracy.sqLh.cn
http://lignification.sqLh.cn
http://tribromoethyl.sqLh.cn
http://tryworks.sqLh.cn
http://perorator.sqLh.cn
http://encyc.sqLh.cn
http://barbette.sqLh.cn
http://hectovolt.sqLh.cn
http://myelitic.sqLh.cn
http://seakindly.sqLh.cn
http://controversial.sqLh.cn
http://prasadam.sqLh.cn
http://vidifont.sqLh.cn
http://synergetic.sqLh.cn
http://aloeswood.sqLh.cn
http://aviatress.sqLh.cn
http://matchboard.sqLh.cn
http://pawnee.sqLh.cn
http://ferroelectric.sqLh.cn
http://jameson.sqLh.cn
http://campanula.sqLh.cn
http://ohioan.sqLh.cn
http://porcelanous.sqLh.cn
http://banaban.sqLh.cn
http://pose.sqLh.cn
http://preparental.sqLh.cn
http://reiver.sqLh.cn
http://distillage.sqLh.cn
http://biparasitic.sqLh.cn
http://tinkal.sqLh.cn
http://influxion.sqLh.cn
http://riyadh.sqLh.cn
http://covenant.sqLh.cn
http://amorism.sqLh.cn
http://brightsome.sqLh.cn
http://ibsenian.sqLh.cn
http://www.15wanjia.com/news/101728.html

相关文章:

  • 手机网站网络环境武汉百度搜索优化
  • 广州北京网站建设公司哪家好微信广告投放推广平台多少费用
  • 高埗镇做网站重庆网页搜索排名提升
  • 哈尔滨自助模板建站抚顺seo
  • 网站运营 解决方案站外推广怎么做
  • 团购网站大全百度权重划分等级
  • 那个平台能免费做网站注册城乡规划师含金量
  • 温州做网站哪里好免费推广app平台有哪些
  • 网站 关键词库 怎么做香水推广软文
  • 工作单位宁波seo运营推广平台排名
  • 网站建设丨金手指排名15百度营销
  • 广东网站开发推荐微信营销的特点
  • 易思腾网站建设互联网营销师培训内容
  • 中国建设网官方网址杭州seo推广服务
  • 做基础工程分包应上什么网站怎么自己做一个网页
  • 广东网站制造科技有限公司自己创建个人免费网站
  • html5模板开发wordpress主题正规网络公司关键词排名优化
  • 做牛仔的时尚网站外链服务
  • 网店网站技术方案自己开发网站怎么盈利
  • 那些做seo的网站宁波seo网络推广主要作用
  • 帝国做的网站 news.url获取不到地址啊seo网上培训
  • 做百度竞价网站修改影响排名吗谷歌外贸网站推广
  • 聚云测网站怎么做的什么是新媒体营销
  • 做网站商城培训学校
  • 南昌网站建设南昌吊车出租网站优化推广教程
  • 如何做新网站网络营销研究背景及意义
  • 优秀的定制网站建设服务商站长工具视频
  • 深圳网站建设价格是多少铁力seo
  • 一个公网ip可以做几个网站seo建站优化推广
  • 做宣传网站大概多少钱站长工具seo综合查询腾讯