戳人痛处

导航

1 2 3 4 5 ··· 7 下一页

2024年6月13日 #

[记]tokio学习

摘要: spawn_blocking use std::thread; use std::time; use tokio::time::{sleep,Duration}; fn blocking_call() -> String{ for idx in 0..5{ thread::sleep(time::D 阅读全文

posted @ 2024-06-13 10:47 戳人痛处 阅读(7) 评论(0) 推荐(0) 编辑

2024年5月20日 #

[记]rust armv7交叉编译

摘要: .cargo/config.toml [build]target = "armv7-unknown-linux-gnueabihf"[target.armv7-unknown-linux-gnueabihf]linker = "arm-none-linux-gnueabihf-gcc" 阅读全文

posted @ 2024-05-20 09:14 戳人痛处 阅读(24) 评论(0) 推荐(0) 编辑

2024年4月26日 #

error: possibly undefined macro: AC_CHECK_HEADERS

摘要: Hi, I have been getting the below error after running ./bootstrap: autoreconf: running: /usr/bin/autoconf --force --warnings=all configure.ac:133: err 阅读全文

posted @ 2024-04-26 09:33 戳人痛处 阅读(40) 评论(0) 推荐(0) 编辑

2023年12月28日 #

[记]在rust中使用xml,xml的序列化与反序列化

摘要: 序 在rust中有好几个xml库,但我个人比较推荐的是quick_xml库,这个库的序列化和反序列化使用体验比较好。 启用quick_xml的feature quick-xml = { version = "0.31.0",features=["serde","serialize"] } serde 阅读全文

posted @ 2023-12-28 11:31 戳人痛处 阅读(164) 评论(0) 推荐(0) 编辑

2023年9月19日 #

[记] tokio多任务的延时

摘要: use tokio::{time}; async fn hh1(){ for _ in 0..10{ time::sleep(std::time::Duration::from_secs(3)).await; println!("11"); } } async fn hh2(){ for _ in 阅读全文

posted @ 2023-09-19 14:14 戳人痛处 阅读(20) 评论(0) 推荐(0) 编辑

2023年8月18日 #

[记]Rust性能优先的编译优化设置

摘要: 参考:Profiles - The Cargo Book (rust-lang.org) [profile.release] strip = true opt-level = "s" lto = "fat" codegen-units = 1 panic = "abort" 阅读全文

posted @ 2023-08-18 14:39 戳人痛处 阅读(66) 评论(0) 推荐(0) 编辑

2023年7月20日 #

[记]Rust全局变量+多线程

摘要: ~~~rust static mut Gods: f32 = 0.0; fn main() { std::thread::spawn(|| loop { unsafe { Gods += 1.0; } esleep::s(1);//延时1s }); std::thread::spawn(|| loo 阅读全文

posted @ 2023-07-20 14:07 戳人痛处 阅读(57) 评论(0) 推荐(0) 编辑

2023年7月19日 #

[记]Rust使用windows库开发串口功能

摘要: 在Rust中,可以使用windows库来操作串口。以下是一个使用windows库实现串口功能的示例代码: 首先,在你的Cargo.toml文件中添加以下依赖项: ~~~toml [dependencies] windows = "0.36.0" ~~~ 然后,可以按照以下代码示例使用windows库 阅读全文

posted @ 2023-07-19 15:41 戳人痛处 阅读(808) 评论(0) 推荐(0) 编辑

2023年7月4日 #

[记]Rust闭包加动态分发

摘要: ~~~rust pub trait App { fn run(&mut self); } #[derive(Clone, Copy)] pub struct Cda{ d:i32, } impl Cda { fn new(num:i32)->Self{ Self { d: num } } fn in 阅读全文

posted @ 2023-07-04 13:32 戳人痛处 阅读(26) 评论(0) 推荐(0) 编辑

2023年6月6日 #

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

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

posted @ 2023-06-06 17:29 戳人痛处 阅读(194) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 7 下一页