mlua v0.4 发布并支持Lua 5.4

mlua v0.4 released with Lua 5.4 support

https://github.com/khvzak/mlua

mlua v0.4 发布并支持Lua 5.4。

v0.4 changelog

MiniCouchDB: implementing a subset of CouchDB in Rust

MiniCouchDB: implementing a subset of CouchDB in Rust

https://www.garrensmith.com/blogs/mini-couch-hack-week https://github.com/garrensmith/couch_hack_week

受mini-redis启发,搞了一个mini-CouchDB in Rust.

Benchrs: Apache Benchmark(ab) clone in rust

Benchrs: Apache Benchmark(ab) clone in rust https://crates.io/crates/benchrs

Apache Benchmark style http bench tool written in async rust.

Benchrs 0.1.7
Arkaitz Jimenez <arkaitzj@gmail.com>
Does http benchmarksUSAGE:benchrs [FLAGS] [OPTIONS] <url>FLAGS:-h, --help       Prints help information-k               Enables keep alive-V, --version    Prints version information-v               Increases verbosityOPTIONS:-c <concurrency>           Sets the concurrency level-H <header>...             Sets a custom header-m <method>                Request method: default GET-p <postfile>              File attach as request body-n <request number>        Sets the number of requestsARGS:<url>    The url to hit

Rust/WinRT快速入门

Getting started with Rust/WinRT

https://kennykerr.ca/2020/06/05/getting-started-with-rust-winrt/

加拿大小伙子Kenny Kerr写的Rust/WinRT编程快速入门。

Rust/WinRT编程快速入门已经非常简单,这得益于程序员喜欢的Rust语言编程工具链提供了大量的便利。如果你想不需要额外的帮助直接入门,下面是一些有用的链接

  • GitHub: https://github.com/microsoft/winrt-rs

  • Docs.rs: https://docs.rs/winrt/

  • Crates.io: https://crates.io/crates/winrt

下面会给一些个人的心得和小技巧:

安装先决条件和工具:

  • Visual Studio 2019 – be sure to install the C++ tools as this is required by the Rust compiler (only the linker is required).

  • Visual Studio Code – this is the default IDE used for Rust.

  • Python – be sure to install the x64 version as this is required for debugging support.

  • Git – Rust has deep support for Git.

  • Rust – this installs rustup which is a tool for installing Rust toolchains and common Rust related tooling.

打开VS Code然后键入Ctrl+Shift+X打开扩展页安装下面的extensions:

  • rust-analyzer – there are others, but this is the only Rust extension that I’ve tried that actually works reliably most of the time.

  • CodeLLDB – you can also use the Microsoft C++ extension for debugging, but this one does a better job of integrating with the IDE.

  • C/C++ – the Microsoft C++ extension doesn’t integrate as well with the IDE, but provides superior debugging information, so you may want to have that on hand for an emergency.

提示下载并安装Rust language server,确认安装,然后重新启动IDE。然后我们开始用新的cargo包创建例子:

C:\>cargo new sampleCreated binary (application) `sample` packageC:\>cd sample
C:\sample>code .

新创建的项目目录下修改Cargo.toml配置文件,并添加WinRT的依赖库包:

[dependencies]
winrt = "0.7.0"

确认所有的库是最新的,然后开始编译项目:

C:\sample>cargo buildUpdating crates.io indexCompiling proc-macro2 v1.0.18Compiling unicode-xid v0.2.0...Compiling winrt_gen_macros v0.7.0Compiling winrt_gen v0.7.0Compiling winrt_macros v0.7.0Compiling winrt v0.7.0Compiling sample v0.1.0 (C:\sample)Finished dev [unoptimized + debuginfo] target(s) in 19.65sC:\sample>cargo runFinished dev [unoptimized + debuginfo] target(s) in 0.06sRunning `target\debug\sample.exe`
Hello, world!

在项目文件夹里找到写hello world的源文件main.rs,我们用winrt::import macro来生成Rust bindings for WinRT的APIs:

winrt::import!(dependenciesostypeswindows::data::xml::dom::*
);

其实你在main.rs里面任何位置放置上面的代码都可以,这个导入的宏分成两个部分:一类是你的项目中需要标识WinRT组件,另一类是特别需要相应的类型子集。这里用了os表示需要运行的操作系统,也可以指定特定版本的Windows SDK。然后指定了官方文档中的一些类型windows::data::xml::dom 下面还有用了XmlDocument,具体的细节可以参考官方文档:

fn main() -> winrt::Result<()> {use windows::data::xml::dom::*;let doc = XmlDocument::new()?;doc.load_xml("<html>hello world</html>")?;let root = doc.document_element()?;assert!(root.node_name()? == "html");assert!(root.inner_text()? == "hello world");Ok(())
}

编译运行的结果:

C:\sample>cargo runCompiling sample v0.1.0 (C:\sample)Finished dev [unoptimized + debuginfo] target(s) in 8.71sRunning `target\debug\sample.exe`

这样,import宏导进来的库就可以开始调用指定的Windows API了。

rust语言写斗兽棋游戏

Animal Fight Chess Game written in rust.

https://github.com/netcan/AnimalChess

Animal Fight Chess Game(斗兽棋) written in rust. Rust语言写斗兽棋游戏

游戏规则和玩法:

  • http://ancientchess.com/page/play-doushouqi.htm

  • https://en.wikipedia.org/wiki/Jungle_(board_game)

编译和运行:

git clone https://github.com/netcan/AnimalChess.git
cd AnimalChess
cargo run --release

From 日报小组 BobQ

【Rust日报】2020-06-08 - Rust/WinRT快速入门相关推荐

  1. 【Rust日报】2020-11-03 《Rust日报》总第1000期

    今日头版 <Rust日报>第1000期,感谢有你 两年半的时间,我们一期期走来,到了今天发行的第1000期.回想我第一次看<Rust日报>,还是在Rust 2018刚推出的时候 ...

  2. 【Rust 日报】2021-08-29 Embedded Rust 第一步:选择一块板子

    Embedded Rust 第一步:选择一块板子 内容整理自 robyoung (Rob Young) 的文章:First steps with Embedded Rust: Selecting a ...

  3. 【Rust日报】 2019-05-31:rust.cc社区提供了国内crates镜像

    Enum的值如何作为类型 這位寫C++的老兄想寫以前的Enum fn pet(_: Animal::Whale) {}fn pet(_: Animal::Dog) {}// or somehow de ...

  4. 【Rust日报】 2019-05-15:Rust 4周岁生日快乐!

    Rust四周年啦 不知不觉,Rust1.0发布已经四周年了. Rust 1.0是2015年5月15号发布.所以,四年了,大家学会Rust了吗? Rust四周年 Rust完全态 所以我说,Rust还有两 ...

  5. 【Rust日报】2022-03-22 fluent-uri:一个快速、简单和严格的URI解析器

    fluent-uri:一个快速.简单和严格的URI解析器 Announcing fluent-uri: a fast, easy and strict URI parser 简介 一个严格遵守IETF ...

  6. 【Rust日报】2020-11-30 编写 Rust 的 23 条基本规则和建议

    编写 Rust 的 23 条基本规则和建议 Seed 是一个优秀的 Rust 前端框架, 但是, 这里我们不讨论 Seed 本身, 而是隐藏在这个优秀项目里的一些优秀的建议. 在他的文档中,Seed给 ...

  7. 【Rust日报】2022-09-14 使用 Rust 构建简单博客 华为实习生招募

    使用 Rust 构建简单博客 作者以写 Go 为主,他认为学习任何语言都可以从一个 web 程序入手,那么事情就会变得明朗,本文展示的是作者在学习了一段时间 Rust 后开始搭建简单博客系统的过程,很 ...

  8. 人工智能 | ShowMeAI资讯日报 #2022.06.08

    ShowMeAI日报系列全新升级!覆盖AI人工智能 工具&框架 | 项目&代码 | 博文&分享 | 数据&资源 | 研究&论文 等方向.点击查看 历史文章列表, ...

  9. 【Rust 日报】2022-04-10 适用于Rust的异步CQL驱动

    scylla-rust-driver:适用于 Rust 的异步 CQL 驱动程序 这是 ScyllaDB 的客户端驱动程序,用纯 Rust 编写,使用 Tokio 实现完全异步 API.尽管针对 Sc ...

最新文章

  1. Redis 到底是怎么实现“附近的人”这个功能的?
  2. data:image/png;base64,, CTF杂项base64图片隐写-河南省第二届金盾信安杯
  3. java8压缩,如何使用Java 8压缩多个列表?
  4. linux echo写php编码,linux使用和基础操作(示例代码)
  5. SDNU 1469.校门外的树(水题)
  6. codeforce R 491 (div2)
  7. 牛客-仓鼠的石子游戏【博弈论】
  8. mysql snowflake_雪花算法-snowflake
  9. oracle分布式事物锁,ORA-02049:超时:分布式事务处理等待锁诊断-Oracle
  10. 【Cinemachine智能相机教程】VirtualCamera(四):Noise属性
  11. 微信上线「行程查询」服务;钉钉 CEO 回应被打「一星」;Go 1.14 发布 | 极客头条...
  12. git原理详解与实操指南_全网最精:学git一套就够了,从入门到原理深度剖析
  13. DAO基本登录(1)
  14. exoplay切换全屏_基于exoPlayer 拓展自定义播放器
  15. 蒙牛新品来了,小明纯牛奶透明袋
  16. Bootstrap实战(第一弹:栅格实现5等分或8等分)
  17. ps 简单的抠图操作
  18. NLPCC数据集汇总
  19. virtualbox虚拟机窗口大小调整
  20. python中 代表什么,python中是什么意思

热门文章

  1. 怎么提高今日头条号推荐量、阅读量、播放量
  2. Prometheus简介与部署
  3. 机器学习——XgBoost特征筛选
  4. QQ好友——功能:“在线对其隐身”和“隐身对其可见”
  5. 三个数差的平方公式推导过程_立方和与立方差公式的推导过程
  6. SortableJS/Vue.Draggable
  7. web前端开发工程师之HTML+CSS初级到精通系列课程-陈璇-专题视频课程
  8. 计算两点间的距离 --JAVA
  9. 台积电嘲讽英特尔CEO:不可能超越我们了,安心退休吧
  10. 应用没能杀死浏览器,浏览器反而变成了应用