当前位置: 首页 > 工具软件 > C2Rust > 使用案例 >

【Rust日报】2022-3-4 一个用 rust 编写的命令和控制框架

万嘉石
2023-12-01

一个用 rust 编写的命令和控制框架

link 是一个用 rust 编写的命令和控制框架。目前处于测试阶段。link 提供了 MacOS、Linux 和 Windows 植入程序,这些植入程序可能缺乏其他更成熟的命令和控制框架提供的必要规避技术。构建过程:

git clone repo
cargo run 
cargo build --release #构建链接服务器可执行文件
  • https://github.com/postrequest/link

厌倦了安全编程?将 C 直接嵌入到您的 Rust 代码中!

embed-c是一个允许你在 Rust 代码文件中嵌入 C 代码的 crate。C 代码在编译时使用 C2Rust 翻译成 Rust 代码,这意味着它可以与 Rust 完全互操作。C 代码可以调用 Rust 代码,反之亦然。

#![feature(rustc_private)] 

use embed_c::embed_c;

embed_c! {
    int add(int x, int y) {
        return x + y;
    }
}

fn main() {
    let x = unsafe { add(1, 2) };
    println!("{}", x);
}

您只需要:

git clone https://github.com/zdimension/embed-c.git
cd embed-c
git submodule update --init c2rust
cp Cargo.lock ..
cd ..

并在 toml 中:

[dependencies]
embed-c = { path = "./embed-c", version = "0.1" }

[patch.crates-io]
c2rust-transpile = { path = "./embed-c/c2rust/c2rust-transpile" }

[toolchain]
channel = "nightly-2019-12-05"

[package]
edition = "2018"

然后就可以构建程序了,更多例子在链接中

  • https://github.com/zdimension/embed-c


From 日报小组 侯盛鑫 坏姐姐

社区学习交流平台订阅:

  • Rust.cc 论坛: 支持 rss

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

 类似资料: