05 2020 档案
摘要:macro_rules! four { () => {1 + 3}; } fn main(){ println!("{}", 1+four!()); println!("{}", 2+four![]); println!("{}", 3+four!{}); } HIR阶段是将 你撸的代码转为AST。
阅读全文
摘要:最近在umi. 设置一个layout字段, 结果左边菜单栏就出现了。 很神奇。 决定对这个库一探究竟。 我是一个喜欢看底层库的人,网上所有的启动方式都是yarn或者npm start 启动服务。然后在浏览器运行调试的。 这个调试的是前端。 我想调试的是后端。 通过跟踪,发现其实 yarn start
阅读全文
摘要:将源代码转为高级中间表示,在将其转为中级中间表示,在将其转为LLVM IR, 最终输出机器码。 rust 租借检查 选项优化,代码生成(宏, 范型) , 都是在MIR层。
阅读全文
摘要:pub trait Summary { fn summarize_author(&self) -> String; fn summarize(&self) -> String { format!("(Default Read more from {}...)", self.summarize_aut
阅读全文
摘要:之前定义的结构体,都是不含引用的。 如果想定义含引用的结构体,请定义生命周期注解 #[warn(unused_variables)] struct ImportantExcerpt<'a> { part: &'a str, } fn main() { let novel = String::from
阅读全文
摘要:记录一下自己理解的生命周期。 每个变量都有自己的生命周期。 在c++里生命周期好比作用域, 小的作用域的可以使用大作用域的变量。 如果把这里的每个作用域取个名,那么就相当于rust里的生命周期注解。 拿例子说事一: 如果按照c++的方式来理解, 这个x和r的作用域是一样的,都是在main函数中。 但
阅读全文
摘要:fn main(){ for i in 1..10 { for j in 1..i+1 { print!("{}*{}={:<2} ",j,i,i*j); } print!("\n"); } }
阅读全文
摘要:Available codegen options: -C ar=val -- this option is deprecated and does nothing -C linker=val -- system linker to link outputs with -C link-arg=val
阅读全文
摘要:➜ hello_cargo git:(master) ✗ rustc --print code-models Available code models: small kernel medium large
阅读全文
摘要:Available CPUs for this target: native - Select the CPU of the current host (currently haswell). amdfam10 athlon athlon-4 athlon-fx athlon-mp athlon-t
阅读全文
摘要:Rust中的每个值都具有特定的数据类型。 基础类型: 整数,浮点数,布尔值和字符 i8,i16,i32,i64,i64,i128,isize, u8,u16,u32,u64,u64,u128,usize, f64,f32 bool: true false char 复合类型:元组和数组 元组: le
阅读全文
摘要:网站挂到阿里云上, 可以http访问, 也可以https访问。 但是如果用https方式访问网站。发现接口报错。 因为接口只提供http方式。 在谷歌浏览器出现: Mixed Content: The page at '<URL>' was loaded over HTTPS, but reques
阅读全文
摘要:{workspaceRootFolderName} the name of the folder opened in VS C
阅读全文
摘要:当前,以下关键字具有所描述的功能。 as-执行原始类型转换,消除包含项目的特定特征的歧义,或在useand extern crate语句中重命名项目async-返回a Future而不是阻塞当前线程await-暂停执行直到a的结果Future准备好break -立即退出循环const -定义常量项目
阅读全文
摘要:Mac rust环境 rust安装: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rust更新: rustup update rust卸载: rustup self uninstall rust检查: rustc --
阅读全文
摘要:自己想实现一个tcp 粘包,残包的功能。 先看看一些开源的库是怎么实现的。 首先开启一个线程。使劲的执行: skynet_socket_poll skynet_socket_poll 这个玩意是干嘛的呢?就是处理socket消息 工作流: socket_message -> skynet_socke
阅读全文
摘要:最新版本: 2.2.7 npm i pomelo 之后: ➜ haloServer npm i pomelonpm WARN deprecated node-uuid@1.4.0: Use uuid module insteadnpm WARN deprecated json3@3.3.2: Ple
阅读全文