前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Rust日报】2021-08-24 RustSBI 0.2.0-alpha.5 版本发布

【Rust日报】2021-08-24 RustSBI 0.2.0-alpha.5 版本发布

作者头像
MikeLoveRust
发布2021-09-08 10:05:27
3610
发布2021-09-08 10:05:27
举报

RustSBI 0.2.0-alpha.5 版本发布

RustSBI 0.2.0-alpha.5版本发布。良好支持您的业务和学术研究系统,兼容性强,先进的模块化设计,值得信赖。RustSBI是RISC-V下的引导程序环境,它支持多款模拟器和芯片平台。在今年的首届全国大学生系统能力竞赛操作系统赛中,RustSBI被来自全国高校的赛队广泛使用,用于实现自己的比赛用系统,并取得全国一、二和三等奖。

本次更新特性:

  1. 完整支持RISC-V SBI 0.3正式版标准
  2. 支持SBI PMU性能监视扩展

兼容性修改指南:

  1. rustsbi::ecall指令要求[usize; 6],加入ctx.a5;
  2. 降级embedded-hal到0.2.6

文档主页:https://docs.rs/rustsbi/0.2.0-alpha.5/


default-args: 零开销实现带缺省值的函数

default-args: zero-cost default arguments in rust!

通过使用default_args::default_args!宏来实现带缺省值的函数,下面是用例:

代码语言:javascript
复制
use default_args::default_args;

// this would make a macro named `foo`
// and original function named `foo_`
default_args! {
    fn foo(important_arg: u32, optional: u32 = 100) -> String {
        format!("{}, {}", important_arg, optional)
    }
}

// in other codes ...
assert_eq!(foo!(1), "1, 100"); // foo(1, 100)
assert_eq!(foo!(1, 3), "1, 3"); // foo(1, 3)
assert_eq!(foo!(1, optional = 10), "1, 10"); // foo(1, 10)

// let's make another one
default_args! {
    #[inline]
    pub async unsafe extern "C" fn bar<S1, S2, S3>(a: S1, b: S2 = "b", c: S3 = "c") -> String
    where
        S1: AsRef<str>,
        S2: AsRef<str>,
        S3: AsRef<str>,
    {
        format!("{}, {}, {}", a.as_ref(), b.as_ref(), c.as_ref())
    }
    // that was long signature!
}

// in other codes ...
assert_eq!(unsafe { bar!("a") }.await, "a, b, c");
assert_eq!(unsafe { bar!("a", "d") }.await, "a, d, c");
// you can even mix named & unnamed argument in optional arguments
assert_eq!(unsafe { bar!("a", "d", c = "e") }.await, "a, d, e");
assert_eq!(unsafe { bar!("a", c = "e") }.await, "a, b, e");

项目主页:https://github.com/buttercrab/default-args.rs


RustDesk 1.1.8 发布:开源远程桌面软件

RustDesk 1.1.8 release: yet another remote desktop software

开源远程桌面软件RustDesk 1.1.8 版本发布,更多细节参见Release Notes

项目主页:https://github.com/rustdesk/rustdesk


From 日报小组 odd-cat

社区学习交流平台订阅:

Rust.cc 论坛: 支持 rss

微信公众号:Rust 语言中文社区

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2021-08-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Rust语言学习交流 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • RustSBI 0.2.0-alpha.5 版本发布
  • default-args: 零开销实现带缺省值的函数
  • RustDesk 1.1.8 发布:开源远程桌面软件
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档