checker borrow rust

Rust语言 - 接口设计的建议之不意外(unsurprising)

# Rust - 接口设计建议之不意外(unsurprising) 书:Rust for Rustaceans ## Rust接口设计的原则(建议) - 四个原则: - 不意外(unsurprising) - 灵活(flexible) - 显而易见(obvious) - 受约束(constraine ......
不意 unsurprising 接口 语言 建议

[记]Rust结构体转换为二进制数据

这个函数可以直接读取或者转化为二进制数据,适用于系统编程; ~~~rust use std::mem; struct Testdata{ ucc:u8, udd:u8, } fn main() { let ddd = Testdata{ucc:2,udd:9}; unsafe{ let uu16:u ......
二进制 结构 数据 Rust

rust实现weatherforecast的获取天气webapi

rust用来写webapi可能有点大材小用,但是作为入门学习应该说是不错的选择。 cargo new webapi创建一个webapi项目,在src下面新建handler文件夹和models文件夹。 在models文件夹下面建立一个mod.rs和weatherforecast.rs文件。 weath ......
weatherforecast 天气 webapi rust

文盘Rust -- tokio绑定cpu实践

tokio 是 rust 生态中流行的异步运行时框架。在实际生产中我们如果希望 tokio 应用程序与特定的 cpu core 绑定该怎么处理呢?这次我们来聊聊这个话题。 ......
tokio Rust cpu

Rust Web 全栈开发之发布

# Rust Web 全栈开发之发布 ## 发布 ### 第一种方法: WebAssembly不可以 ```bash cargo build --workspace ``` ### 第二种方法:分别对3个项目进行构建 #### 构建 webservice ```bash ws on  main v ......
Rust Web

Rust Web 全栈开发之编写 WebAssembly 应用

# Rust Web 全栈开发之编写 WebAssembly 应用 MDN Web Docs: 官网: ## 项目结构 和 功能 **Web App 教师注册 WebService WebAssembly App 课程管理** ## 什么是 WebAssembly - WebAssembly 是一种 ......
WebAssembly Rust Web

Rust Web 全栈开发之编写服务器端 Web 应用

# Rust Web 全栈开发之编写服务器端 Web 应用 ## 项目结构 和 功能 Web App 教师注册 Web Service ## 主要技术 - 模板引擎: Tera ### 创建项目 ```bash ws on  main via 🦀 1.67.1 via 🅒 base ➜ car ......
Web 服务器 Rust

Rust Web 全栈开发之增加教师管理功能

# Rust Web 全栈开发之增加教师管理功能 ## 增加教师管理功能 ### 目标 #### Actix HTTP Server #### Actix App - Routes - GET /teachers - GET / teachers /{teacher_id} - POST /teac ......
功能 教师 Rust Web

ModuleNotFoundError: No module named 'setuptools_rust'

我在执行pip3 install webssh遇到以下的报错信息。 报错信息Traceback (most recent call last):File “”, line 1, inFile “/tmp/pip-build-my9sai1o/cryptography/setup.py”, line ......

Rust Web 全栈开发之增加字段和重构

# Rust Web 全栈开发之增加字段和重构 ## 增加字段和重构 ### 现状 ![](https://raw.githubusercontent.com/qiaopengjun5162/blogpicgo/master/img/202305311714093.png) ![](https:// ......
字段 Rust Web

Rust每周一库/每周一知

我了解到Rust被视为是新时代的cpp Rust是一种通用的编程语言,但是它更善于以下场景: - 需要运行时的速度 - 需要内存安全 - 更好地利用多处理器 Rust安全,没有GC,易于维护调试。 rust特别擅长的领域:高性能Web service,webAssembly,命令行工具,网络编程,嵌 ......
每周一 Rust

Rust Web 全栈开发之 Web Service 中的错误处理

# Rust Web 全栈开发之 Web Service 中的错误处理 ## Web Service 中的统一错误处理 ### Actix Web Service 自定义错误类型 -> 自定义错误转为 HTTP Response - 数据库 - 数据库错误 - 串行化 - serde 错误 - I/ ......
Web 错误 Service Rust

如何用Rust编写一个ChatGPT桌面应用

今天发现了京东云团队发的一个博客,保存下来慢慢看。 为什么我们需要一个桌面应用 原因实在太多,我们需要便捷地导出记录,需要在回答长度超长的时候自动加上“继续”,需要收藏一些很酷很实用的prompt......(首先我假设你是一名如我一样习惯用IDEA开发的java仔) 为什么是用Rust编写 效率高 ......
桌面 ChatGPT Rust

Rust Web 全栈开发之在 Web 项目中使用数据库

# Rust Web 全栈开发之在 Web 项目中使用数据库 ### 目录 ```bash ws on  master [?] via 🦀 1.67.1 via 🅒 base ➜ tree -a -I target . ├── .git ├── .gitignore ├── Cargo.loc ......
Web 数据库 项目 数据 Rust

rust 测试如何打印 println 输出结果

``` cargo test -- --nocapture or rustc --test main.rs; ./main or (my favorite) cargo watch “test -- --nocapture” ``` https://medium.com/@ericdreichert ......
println 结果 rust

[Rust] Borrow checker

Three rules: There can only be one value owner There can be unlimited immutable borrows (reference) with no mutable references There can be only one m ......
checker Borrow Rust

Rust Web 全栈开发之连接数据库

# Rust Web 全栈开发之连接数据库 ### 需要使用的 crate 和 数据库 - sqlx, v0.5.10 - PostgreSQL ### 创建项目 ```bash ~/rust via 🅒 base ➜ cargo new db Created binary (applicatio ......
数据库 数据 Rust Web

rust 初识基础: 变量、数据类型、函数、所有权、枚举

了解到 rust 和 WebAssembly 的结合使用,可以构建前端应用,而且性能也比较好。初步学习使用 rust 是预编译静态类型语言。 ## 安装 rust 官网下载 [rust-CN](https://www.rust-lang.org/zh-CN/) , 大致了解下为什么选择:高性能、可靠 ......
变量 所有权 函数 类型 基础

Rust Web 全栈开发之 Actix 尝鲜并构建REST API

# Rust Web 全栈开发之 Actix 尝鲜并构建REST API ## 一、Actix 尝鲜 ### 需要使用的crate - actix-web v4.3.1 - actix-rt v2.8.0 ```bash ~ via 🅒 base ➜ cd rust ~/rust via 🅒 b ......
Actix Rust REST API Web

Rust学习笔记——基础篇3:数据类型

# 数据类型 ## 整数类型 |位长度 | 有符号 | 无符号| | | | | | 8-bit | i8 | u8 | | 16-bit | i16 | u16 | | 32-bit | i32 | u32 | | 64-bit | i64 | u64 | | 128-bit | i128 | u ......
类型 基础 笔记 数据 Rust

Rust学习笔记——基础篇2:变量与常量

# 变量和常量 ## 变量 Rust的变量会自动判断类型(也可以手动指定),且不能更改,是强类型语言 ### 不可变变量 ```rust let 变量名 = 值; let 变量名:数据类型 = 值; ``` 变量声明后不可更改,但可以“重新绑定”为其他值(Rust里叫做重影),并且可以绑定为不同的数 ......
常量 变量 基础 笔记 Rust

Rust学习笔记——基础篇1:环境搭建

# 环境搭建 ## Rust [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) ### Windows VS和MinGW二选一(msys用户要安装mingw,不能用clang) ## ......
环境 基础 笔记 Rust

Rust Web 全栈开发之自建TCP、HTTP Server

# Rust Web 全栈开发之自建TCP、HTTP Server ## 课程简介 ### 预备知识 - Rust 编程语言入门 - https://www.bilibili.com/video/BV1hp4y1k7SV ### 课程主要内容 - WebService - 服务器端Web App - ......
Server Rust HTTP Web TCP

Rust Tips 比较数值

# Rust Tips 比较数值 ### 内容 - 比较与类型转换 - 浮点类型比较 ### 可以用这些运算符比较数值 `> = <=` ### 无法比较不同类型的值 ```rust fn main() { let a: i32 = 10; let b: u16 = 100; if a < b { ......
数值 Rust Tips

rust设置国内镜像

## 字节跳动镜像 [字节镜像](http://rsproxy.cn/) ### crates.io 镜像 ~/.cargo/config: ```toml [source.crates-io] # To use sparse index, change 'rsproxy' to 'rsproxy- ......
镜像 rust

使用 Rust 开发一个微型游戏

# 使用 Rust 构建微型游戏 -- 用于理解游戏开发 ## 一、 创建游戏 ### Agenda + 建立项目 + 实现 Game loop + 不同的游戏模式 + 添加玩家 + 添加障碍和计分 + 汇总 ### 理解 Game loop 为了让游戏流畅、顺滑的运行,需要使用 Game loop ......
Rust

Rust async 编程

# Rust async 编程 Asynchronous Programming in Rust: 中文书名《Rust 异步编程指南》: Rust语言圣经(Rust Course): ## 一、[Getting Started](https://rust-lang.github.io/async-b ......
async Rust

[Rust] Option vs Result

`Option` and `Result` are two very central enums in Rust, and they are used for error handling and for representing the absence of a value. Here is a ......
Option Result Rust vs

[Rust] Handle Error

Typescript: import fs from "fs"; const fileName = process.argv[2]; if (fileName) { fs.readFileSync(fileName) .toString() .split("\n") .map((num) => pa ......
Handle Error Rust

[Rust] Option

Typescript: function practice(nums: number[], index: number): number { return (nums[index] ?? index) * 5 } In Rust: fn practice(nums: Vec<usize>, inde ......
Option Rust