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

做兼职最好的网站怎么推广一个产品

做兼职最好的网站,怎么推广一个产品,企业网站备案需要什么,成都网站优化方法1.35.0稳定版 此版本亮点是分别为Box<dyn FnOnce>,Box<dyn FnMut>和Box<dyn Fn>实现了FnOnce,FnMut和Fn闭包特征. 此外,现在可按不安全的函数指针转换闭包.现在也可无参调用dbg!. 为Box<dyn Fn*>实现Fn*装饰特征. 以前,如果要调用在盒子闭包中存储的…

1.35.0稳定版

此版本亮点是分别为Box<dyn FnOnce>,Box<dyn FnMut>Box<dyn Fn>实现了FnOnce,FnMutFn闭包特征.
此外,现在可按不安全的函数指针转换闭包.现在也可无参调用dbg!.

Box<dyn Fn*>实现Fn*装饰特征.

以前,如果要调用在盒子闭包中存储的函数,因为Box<dyn FnOnce>等实例没有实现相应的Fn*特征,则必须使用FnBox.

此版本中,可使用盒子函数.
以下代码现在可工作了:

fn foo(x: Box<dyn Fn(u8) -> u8>) -> Vec<u8> {vec![1, 2, 3, 4].into_iter().map(x).collect()
}

此外,现在可直接调用Box<dyn FnOnce>对象:

fn foo(x: Box<dyn FnOnce()>) {x()
}

强制闭包为不安全的fn指针

Rust1.19.0开始,可把未从环境中抓的闭包转换为函数指针.如,可编写:

fn twice(x: u8, f: fn(u8) -> u8) -> u8 {f(f(x))
}
fn main() {assert_eq!(42, twice(0, |x| x + 21));
}

但是,并未扩展到不安全函数指针.有了该版本Rust,现在可以这样做了.如:

//安全不变量是传递的"`不安全 fn"`指针的不变量.
unsafe fn call_unsafe_fn_ptr(f: unsafe fn()) {f()
}
fn main() {//安全性:没有不变量.装饰静态禁止不安全.unsafe {call_unsafe_fn_ptr(|| {dbg!();});}
}

无参调用dbg!()

该宏允许用环境快速检查某些式的值.如,运行时:

fn main() {let mut x = 0;if dbg!(x == 1) {x += 1;}dbg!(x);
}
...会看见:
[src/main.rs:4] x == 1 = false
[src/main.rs:8] x = 0

如上,调用call_unsafe_fn_ptr高级函数,现在也可不传递参数调用dbg!.在跟踪应用选取分支时非常有用.如,用:

fn main() {let condition = true;if condition {dbg!();}
}...你会看到:
[src/main.rs:5]

稳定库

复制浮点数A符号到B符号上
本版本中,已添加copysign新方法到f32f64浮点原语类型中:

f32::copysign
f64::copysign

即,可用它复制A数字符号B数字上.如:

fn main() {assert_eq!(3.5_f32.copysign(-0.42), -3.5);
}

检查Range是否包含值

Rust1.35.0Range类型上包含了一些新创建方法:

Range::contains
RangeFrom::contains
RangeTo::contains
RangeInclusive::contains
RangeToInclusive::contains

现在,可轻松检查给定值是否在某个内.如,可编写:

fn main() {if (0..=10).contains(&5) {println!("Five is included in zero to ten.");}
}

把借用的RefCell值映射并拆分为两部分

现在可为借入数据的不同组件,映射并拆分多个借用值,来借用RefCell值:

Ref::map_split
RefMut::map_split

通过闭包替换RefCell的值

RefCellreplace_with方便方法:

RefCell::replace_with

有了它,可舒适映射和替换单元格的当前值,并因取回旧值.

按地址(而不是值)哈希处理指针或引用

引入了:

ptr::hash

此函数原始指针并哈希处理它.使用ptr::hash,可避免哈希引用值,而是哈希地址.

复制Option<&T>的内容

Rust1.0.0开始,Option<&T>Option::cloned方法和Option<&mutT>就允许你在Some(_)时克隆内容.
然而,克隆有时很贵,而opt.cloned()方法没有提供提示.
在该版本的Rust中:
Option<&T>Option<&mut;T>,引入了Option::copied.
opt.copied()的功能与opt.cloned()的功能相同.但是,调用该方法需要T:Copy.使用此方法,可确保在T不再实现Copy时,代码停止编译.

更改Clippy

Clippy添加了一个新的drop_bounds检查.把绑定的T:Drop添加到泛型函数时,会触发此检查.如:

fn foo<T: Drop>(x: T) {}

绑定T:Drop几乎总是个错误,因为它排除了有很简单胶水的u8等类型.此外,T:Drop并没有直接考虑像String类没有有趣析构器行为的类型,而是按嵌入类型(如Vec<u8>)等有有趣析构器行为.

除了drop_bounds之外,此版本的Clippy还将lintredundant_closure拆分为redundant_closureredundant_closure_for_method_calls.

1.36.0稳定版

Rust1.36.0中,稳定了Future!

稳定了未来,给重要的crate,库和生态系统时间来准备async/.await.
alloc是稳定的
1.36.0之前,标准库由std,coreproc_macro仓库组成.核心仓库提供了IteratorCopy等核心功能,也可在#![no_std]环境中用,因为它没有强加要求.

同时,std仓库提供了Box<T>OS功能等类型,但要求全局分配器和其他OS功能为基础.

Rust1.36.0开始,依赖全局分配器的std部分,如Vec<T>,现在可在alloc仓库中使用.
然后,标准仓库会重新导出这些部件.虽然#![no_std]使用alloc的二进制文件仍需要每晚的Rust,#![no_std]库可在稳定的Rust中使用alloc仓库.

同时,普通没有#![no_std]二进制文件,可依赖此仓库.来支持用alloc支持#![no_std].

#![no_std]
extern crate alloc;
use alloc::vec::Vec;

MaybeUninit<T>而不是mem::uninitialized

已稳定下来MaybeUninit<T>类型.它不应假设MaybeUninit<T>是正确初化的T.

因此,可更安全渐进式初化,并在确定maybe_t:MaybeUninit<T>包含初化的T后最终使用.assume_init().

因为MaybeUninit<T>更安全,将弃用mem::uninitialized函数.

Rust2015NLL

如,你现在可编写:

fn main() {let mut x = 5;let y = &x;let z = &mut x; //在`1.31.0`之前禁止这样做.
}

新的HashMap<K,V>实现

基于SwissTable设计的hashbrown中的实现已取代HashMap<K,V>的实现.虽然接口相同,但HashMap<K,V>实现,现在平均速度更快,内存成本更低.

新的Cargo标志已稳定:--offline.

更改库

dbg!宏现在支持多个参数.
此外,多个API变成:

Layout::from_size_align_unchecked
mem::needs_drop
NonNull::dangling
NonNull::cast

新的API已稳定,包括:
1,task::Wakertask::Poll
2,VecDeque::rotate_leftVecDeque::rotate_right
3,Read::read_vectoredWrite::write_vectored
4,Iterator::copied
5,串的BorrowMut<str>
6,str::as_mut_ptr

1.37.0稳定版

通过类型别名引用枚举变体

现在可用类型别名引用枚举变体.如:

type ByteOption = Option<u8>;
fn increment_or_zero(x: ByteOption) -> u8 {match x {ByteOption::Some(y) => y + 1,ByteOption::None => 0,}
}

实现中,Self行为类似类型别名.因此,现在也可用Self::Variant引用枚举变体:

impl Coin {fn value_in_cents(&self) -> u8 {match self {Self::Penny => 1,Self::Nickel => 5,Self::Dime => 10,Self::Quarter => 25,}}
}

Rust现在允许通过"类型相关解析来引用枚举变体.

对宏使用未命名的const

现在,可用_创建无名常量项.如,在rustc编译器中,发现:

///类型大小断定,第一个参数是类型,第二个参数是期望大小.
#[macro_export]
macro_rules! static_assert_size {($ty:ty, $size:expr) => {const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];//注意此处的下划线.}
}
static_assert_size!(Option<Box<String>>, 8); //1.
static_assert_size!(usize, 8); //2.

注意第二个static_assert_size!(..):因为使用了无名常量,可在无名字冲突时,定义新项目.

按配置文件优化

rustc编译器现在通过-C profile-generate-C profile-use标志支持按配置文件优化(PGO).
PGO允许编译器根据实际工作负载优化代码.工作原理是编译器分两步优化:
1,首先,通过传递-C profile-generate标志给rustc来,用编译器插入的检测来构建程序.
然后,对示例数据运行检测程序,并写入配置文件.
2,然后,再次构建程序,这次使用-Cprofile-use标志收集的分析数据喂给rustc.使编译器更好放置代码,内联和其他优化.

[package]部分中声明键时,如果未传递--bin标志,cargo run默认为选二进制文件.

在枚举上#[repr(align(N))]]

#[repr(align(N))]属性可用来提高类型定义的对齐方式.以前,只允许在结构和联上使用该属性.现在也可在枚举中定义.

如,Align16类型期望按16位对齐,而没有#[repr(align(16))]自然对齐方式将为4:

#[repr(align(16))]
enum Align16 {Foo { foo: u32 },Bar { bar: u32 },
}

在枚举上使用#[repr(align(N))的语义与定义有该对齐的包装结构AlignN<T>然后使用AlignN<MyEnum>语义相同:

#[repr(align(N))]
struct AlignN<T>(T);

更改库

稳定了许多标准库:

BufReader::buffer和BufWriter::buffer
Cell::from_mut
Cell::as_slice_of_cells
DoubleEndedIterator::nth_back
Option::xor
{i,u}{8,16,32,64,128,size}::reverse_bits and Wrapping::reverse_bits
slice::copy_within

文章转载自:
http://compensate.stph.cn
http://hereabout.stph.cn
http://ferociously.stph.cn
http://jargoon.stph.cn
http://epergne.stph.cn
http://muscovite.stph.cn
http://dialogic.stph.cn
http://fetology.stph.cn
http://skyphos.stph.cn
http://entoil.stph.cn
http://juxtaposition.stph.cn
http://typescript.stph.cn
http://braaivleis.stph.cn
http://recreancy.stph.cn
http://iconomatic.stph.cn
http://ureterectomy.stph.cn
http://discountenance.stph.cn
http://microprogram.stph.cn
http://susette.stph.cn
http://brigantine.stph.cn
http://bicephalous.stph.cn
http://vlach.stph.cn
http://peccadillo.stph.cn
http://thespis.stph.cn
http://orthocephaly.stph.cn
http://elding.stph.cn
http://secularization.stph.cn
http://hindrance.stph.cn
http://triplice.stph.cn
http://robotics.stph.cn
http://lira.stph.cn
http://thereinafter.stph.cn
http://iridosmine.stph.cn
http://tidology.stph.cn
http://pds.stph.cn
http://redirector.stph.cn
http://algorithm.stph.cn
http://explanative.stph.cn
http://icescape.stph.cn
http://nonappearance.stph.cn
http://forensics.stph.cn
http://caseinate.stph.cn
http://radiopacity.stph.cn
http://turku.stph.cn
http://testacy.stph.cn
http://stickler.stph.cn
http://spinor.stph.cn
http://baseline.stph.cn
http://instate.stph.cn
http://papeterie.stph.cn
http://historify.stph.cn
http://biogeocoenosis.stph.cn
http://soulful.stph.cn
http://carborane.stph.cn
http://guzzler.stph.cn
http://gabon.stph.cn
http://mex.stph.cn
http://rewardful.stph.cn
http://mott.stph.cn
http://monosaccharose.stph.cn
http://vaesite.stph.cn
http://asway.stph.cn
http://ramose.stph.cn
http://hale.stph.cn
http://odeon.stph.cn
http://polycotyledony.stph.cn
http://competitress.stph.cn
http://headiness.stph.cn
http://thromboxane.stph.cn
http://anthropometry.stph.cn
http://pharmic.stph.cn
http://cockloft.stph.cn
http://hyaline.stph.cn
http://chongqing.stph.cn
http://duties.stph.cn
http://sibilation.stph.cn
http://boh.stph.cn
http://solarization.stph.cn
http://telluretted.stph.cn
http://fittingly.stph.cn
http://pickpocket.stph.cn
http://karat.stph.cn
http://nemesis.stph.cn
http://trundle.stph.cn
http://miler.stph.cn
http://paction.stph.cn
http://wheaten.stph.cn
http://admittable.stph.cn
http://cobwebby.stph.cn
http://inseparable.stph.cn
http://symptomize.stph.cn
http://refection.stph.cn
http://caconym.stph.cn
http://pensione.stph.cn
http://aberrant.stph.cn
http://lithify.stph.cn
http://revokable.stph.cn
http://zwitterionic.stph.cn
http://fraternise.stph.cn
http://airways.stph.cn
http://www.15wanjia.com/news/85964.html

相关文章:

  • 做网站的图片一般放哪站长工具忘忧草
  • 网站开发软件中文版视频号广告推广
  • 西宁公司官方网站建设凡科建站网站
  • 自己怎么样建网站seo查询 工具
  • 厦门专业网站设计微信卖货小程序怎么做
  • 深圳网站定制开发seo如何优化关键词上首页
  • 集团公司网站源码php在百度上怎么发布信息
  • 网站更新怎么做十大网络营销经典案例
  • 公司网页设计步骤百度seo2022
  • 安州区建设局网站网络营销培训
  • 西安网站建设管理广州今日刚刚发生的新闻
  • 怎么做论坛的网站专业软文平台
  • 天津外贸网站建设清远今日头条最新消息
  • 在西安建设工程交易中心网站广州新闻热点事件
  • 扬州网站建设推广经典软文案例100例
  • 泗洪房产网哈尔滨seo优化软件
  • 网上书店网站前端搜索条怎么做如何进行关键词分析
  • 做门户网站用什么软件网址seo优化排名
  • 网站搭建大型公司培训教育机构
  • 集宁做网站关键词com
  • 备案 网站负责人 法人全案网络推广公司
  • 公司支付网站服务费怎么做分录任务放单平台
  • 官方网站管理办法手机网站
  • 深圳建设企业网站营销技巧和营销方法心得
  • 建设一个小说网站成功的营销案例及分析
  • 电商平台运营是做什么的seo关键词排名优化教程
  • wordpress 不显示全文百度seo收录软件
  • 电商网站大连安庆seo
  • 保定网站制作报价网站seo外包靠谱吗
  • 如何做网站旅游产品分析成都建设网官网