rust 服务端

2021-04-26
1分钟阅读时长

参考:https://blog.csdn.net/tianlangstudio/article/details/106169242

  • 1.安装rust
sudo curl https://sh.rustup.rs -sSf | sh

https://www.rust-lang.org/zh-CN/tools/install

  • 2.创建项目
cargo new rust_login –bin
  • 3.在Cargo.toml文件中配置需要的依赖
[package]
name = "rust_login"
version = "0.1.0"
authors = ["Tianlang <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix-web="2" #使用的actix-web 提供web服务器、request解析、response生成等功能
actix-rt="1" #actix-rt actix的运行时,用于运行异步函数等,可以理解为Java concurrent下的Executor
#serde用于序列化和反序列化对象的,比如把对象转换成一个Json字符串,就是序列化; 
#把Json字符串转换为一个对象,就是反序列化
serde="1"