摘要: RUST 实现 Future trait rust 的 Future 可以简单理解成一个状态机,async/await 是实现 Future trait 的语法糖 use std::{sync::{Arc, Mutex}, task::Waker, time::Duration}; #[tokio: 阅读全文
posted @ 2025-09-19 16:33 等你下课啊 阅读(3) 评论(0) 推荐(0)
摘要: Rust 类型系统相关常见术语及解释如下: 1. 类型注解(Type Annotation) 定义:在代码中显式写出变量、参数或返回值的类型。 示例:let x: i32 = 5; 2. 类型推导(Type Inference) 定义:编译器根据上下文自动判断变量或表达式的类型,无需显式注解。 示例 阅读全文
posted @ 2025-08-15 16:34 等你下课啊 阅读(7) 评论(0) 推荐(0)
摘要: 为了解决rust交叉编译各种不兼容问题,使用docker直接构建运行时环境进行编译 Dockerfile FROM ubuntu:24.04 LABEL org.opencontainers.image.source=https://github.com/rust-lang/docker-rust 阅读全文
posted @ 2025-08-14 18:13 等你下课啊 阅读(59) 评论(0) 推荐(0)
摘要: 循环调度 tokio::time::interval 与 tokio::time::sleep 场景设定 我们设定一个具体的场景来对比两种方式: 任务描述: 每次循环中执行一个任务,该任务耗时 5 秒 设置间隔为 3 秒 总运行时间:20 秒 方式一:使用 interval.tick().await 阅读全文
posted @ 2025-07-22 16:15 等你下课啊 阅读(35) 评论(0) 推荐(0)
摘要: 解决下载中文txt文件乱码 iconv -f GBK -t UTF-8 input.txt > output.txt 阅读全文
posted @ 2025-06-17 10:43 等你下课啊 阅读(7) 评论(0) 推荐(0)
摘要: RUST ethers 针对不支持EIP-1559交易类型的网络发起合约调用 use std::sync::Arc; use ethers::{ contract::abigen, middleware::SignerMiddleware, providers::{Http, Middleware, 阅读全文
posted @ 2025-03-28 23:44 等你下课啊 阅读(18) 评论(0) 推荐(0)
摘要: RUST 基于map_err的卫语句错误处理方式 使用扩展方法 use tracing::error; use eyre::Result; pub trait LogErrExt<T> { /// 记录错误日志后返回原 Result /// /// error!("[{}] 错误详情: {}", c 阅读全文
posted @ 2025-03-28 23:03 等你下课啊 阅读(85) 评论(0) 推荐(0)
摘要: RUST cargo 换源 # ~/.cargo/config 被弃用, 使用 ~/.cargo/config.toml vim ~/.cargo/config.toml [source.crates-io] #registry = "https://github.com/rust-lang/cra 阅读全文
posted @ 2025-03-28 22:47 等你下课啊 阅读(31) 评论(0) 推荐(0)
摘要: Docker 运行RabbitMQ # 1. 启动 docker systemctl start docker # 2. 拉取镜像 docker pull rabbitmq:3.8-management # rabbitmq:3.8 是start较多的版本,rabbitmq:3.8-manageme 阅读全文
posted @ 2025-02-18 15:52 等你下课啊 阅读(117) 评论(0) 推荐(0)
摘要: Windows 11 彻底卸载MySQL和安装 卸载 1. 关闭 MySQL 服务 快捷键 Win + R 打开运行窗口 输入 services.msc 打开服务窗口 找到 MySQL 服务,停止此服务 2. 卸载 MySql 软件 进入 控制面板 - 程序和功能 卸载一切和 MySQL 相关的软件 阅读全文
posted @ 2024-09-25 14:36 等你下课啊 阅读(2932) 评论(0) 推荐(1)