Rust开发环境搭建

准备

安装

curl https://sh.rustup.rs -sSf | sh

hello world

  1. 执行cargo new helloworld会自动生成helloworld目录

    1
    2
    3
    4
    // main.rs
    fn main() {
    println!("Hello, world!");
    }
  2. 执行cargo build构建,执行二进制文件运行

  3. 也可以执行cargo run直接运行

xdp demo

参考这个:
https://www.cnblogs.com/davad/p/16883527.html

效果

参考

1
2
3
rust:
https://hujiyi.gitee.io/2020/02/03/download-Rustup-and-install-Rust-with-USTC-mirrors/
https://www.modb.pro/db/214854