随笔分类 - rust
摘要:代码如下 use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] struct Person { id: String, name: String, } #[derive(Serialize, Deserializ
阅读全文
摘要:最初要写一段从redis的hash获取json字符串,转化为结构体,代码逻辑如下 use redis::{Client, Commands, Connection, Iter}; use serde::{Deserialize, Serialize}; const HASH_KEY: &str =
阅读全文
摘要:首先需要在项目依赖Cargo.toml添加lazy_static依赖项 [dependencies] lazy_static = "1.4.0" 示例代码如下: use lazy_static::lazy_static; use std::sync::{RwLock, RwLockReadGuard
阅读全文