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
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 https://crates.io/crates/benchrs
Apache Benchmark style http bench tool written in async rust.
Benchrs 0.1.7
Arkaitz Jimenez
Does http benchmarks
USAGE:
benchrs [FLAGS] [OPTIONS]
FLAGS:
-h, --help Prints help information
-k Enables keep alive
-V, --version Prints version information
-v Increases verbosity
OPTIONS:
-c Sets the concurrency level
-H ... Sets a custom header
-m Request method: default GET
-p File attach as request body
-n Sets the number of requests
ARGS:
The url to hit
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 sample
Created binary (application) `sample` package
C:\>cd sample
C:\sample>code .
新创建的项目目录下修改Cargo.toml配置文件,并添加WinRT的依赖库包:
[dependencies]
winrt = "0.7.0"
确认所有的库是最新的,然后开始编译项目:
C:\sample>cargo build
Updating crates.io index
Compiling proc-macro2 v1.0.18
Compiling unicode-xid v0.2.0
...
Compiling winrt_gen_macros v0.7.0
Compiling winrt_gen v0.7.0
Compiling winrt_macros v0.7.0
Compiling winrt v0.7.0
Compiling sample v0.1.0 (C:\sample)
Finished dev [unoptimized + debuginfo] target(s) in 19.65s
C:\sample>cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target\debug\sample.exe`
Hello, world!
在项目文件夹里找到写hello world的源文件main.rs,我们用winrt::import macro来生成Rust bindings for WinRT的APIs:
winrt::import!(
dependencies
os
types
windows::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("hello world")?;
let root = doc.document_element()?;
assert!(root.node_name()? == "html");
assert!(root.inner_text()? == "hello world");
Ok(())
}
编译运行的结果:
C:\sample>cargo run
Compiling sample v0.1.0 (C:\sample)
Finished dev [unoptimized + debuginfo] target(s) in 8.71s
Running `target\debug\sample.exe`
这样,import宏导进来的库就可以开始调用指定的Windows API
了。
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