随笔分类 -  rust

记录一些rust语言的代码
摘要:git的基本机制 学习git,看这本书是很推荐的,各个语言的版本都有 Git 然后就是这个网站 Learn Git Branching 最后,会用git了,还可以来开发git: mega里面的libra是一个类似于git的工具,目前已经实现了基本功能,但还不够成熟,使用纯rust进行开发 项目meg 阅读全文
posted @ 2025-05-19 14:52 念秋 阅读(23) 评论(0) 推荐(0)
摘要:1.Cell use std::cell::Cell; #[derive(Debug)] struct SomeStruct { regular_field: u8, special_field: Cell<u8>, } fn main() { let my_struct = SomeStruct 阅读全文
posted @ 2025-01-01 14:47 念秋 阅读(90) 评论(0) 推荐(0)
摘要:一.Windows下Rust与C/C++互相调用 欢迎查看github的地址C/C++和Rust的互相调用,写得更加完善清楚,本篇博客真是懒得改了,我自己也看不懂以什么顺序写的,太乱了。 1.C/C++调用rust 1.1动态库调用 1.1.1以LoadLibrary方式显示调用 add.rs #[ 阅读全文
posted @ 2024-12-28 17:25 念秋 阅读(1133) 评论(0) 推荐(0)
摘要:前提知识: rust里面有move,copy,clone。 所有对象都有一个类型,具体所有权。 比如 #[derive(Debug)] struct Complex { real: f64, imag: f64, } fn main() { let a = Complex{real:1.,imag: 阅读全文
posted @ 2024-12-27 15:17 念秋 阅读(45) 评论(0) 推荐(0)
摘要:1.HahsMap https://rustwiki.org/zh-CN/std/collections/struct.HashMap.html 跟着文档,查看一下hashmap的方法,调试,输出一下,就能学会使用了。 use std::collections::HashMap; use std:: 阅读全文
posted @ 2024-10-30 21:07 念秋 阅读(144) 评论(0) 推荐(0)
摘要:1.trait的基本使用 最基本的trait struct Person { name:String, id:i32, } struct Teacher { name:String, id:i32, } trait sayHello { fn say_hello(&self) { println!( 阅读全文
posted @ 2024-10-29 15:05 念秋 阅读(120) 评论(0) 推荐(0)
摘要:由C++指针和引用引发的思考 #include<iostream> using namespace std; void c1(int a) { a = 6; } void c2(int* a) { *a = 7; } void c3(int& a) { a = 8; } int main() { i 阅读全文
posted @ 2024-10-28 23:48 念秋 阅读(133) 评论(0) 推荐(0)
摘要:use std::collections::HashMap; use std::sync::OnceLock; const B64: [char; 65] = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N' 阅读全文
posted @ 2024-10-22 14:24 念秋 阅读(236) 评论(0) 推荐(0)