tips for learning rust

资料 The Rust Programming Language Rust Language Cheat Sheet Zero to Production in Rust This Week in Rust awesome-rust awesome-cli-rust tools and libaries cargo-asm A cargo subcommand that displays the generated assembly of Rust source code. cargo-fuzz A cargo subcommand for fuzzing with libFuzzer hyperfine A command-line benchmarking tool flamegraph sqlx yarte opentelemetry thiserror rust-clippy Serde Tokio Rocketi Rocket Diesel Rayon Actix Hyper Anyhow Thiserror PyO3 Rkyv 心法

writing a tree in rust

define the tree structure 1 2 3 4 5 6 7 #[derive(PartialEq)] struct TreeNode<T> { pub value: Option<T>, pub children: Vec<Rc<RefCell<TreeNode<T>>>>, pub parent: Option<Rc<RefCell<TreeNode<T>>>>, } new tree 1 2 3 4 5 6 7 pub fn new() -> TreeNode<T> { TreeNode { value: None, children: vec![], parent: None, } } add_child 1 2 3 pub fn add_child(&mut self, new_node: Rc<RefCell<TreeNode<T>>>) { self.children.push(new_node); } del_child 1 2 3 4 pub fn del_child(&mut self, node_to_remove: Rc<RefCell<TreeNode<T>>>) { self.

Error: ENS is not supported on network private

Error 1 2 3 4 5 6 7 \node_modules\web3-eth-ens\lib\ENS.js:482 throw new Error("ENS is not supported on network " + networkType); ^ Error: ENS is not supported on network private at ENS.checkNetwork (\node_modules\web3-eth-ens\lib\ENS.js:482:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) 原因 将web3实例作为参数,误传给函数,导致web3实例对应的内存被踩

常用Defi工具与网站

DeBank DeBank 是一款DeFi资产跟踪和投资组合管理工具。 优点: 支持多链 不仅支持链上帐户资产也支持TVL资产 支持多种协议 支持帐号approve风险提示 缺

说说519事件

背景 加密货币历史上几次大跌: 2017年94事件 2020年312事件 2021年423事件 2021年519事件 每次大跌都验证一句话:币圈一天,人

100 days, 100 english sentences

day1 2021年1月16日 星期六 1 There is considerable debate over how we should react if we detect a signal from an alien civilisation. 翻译: 如果我们探测到了来自外星文明的信号,我们应该如何回应是一个备受争议的

Demystifying NFTs by Naval

NFT is blooming. Naval’s insightful viewpoints about NFTs as follow: An NFT is a unique, on-chain token representing ownership of an off-chain asset. The token is backed by a social contract from its creator and a surrounding community. By assigning a unique token to a thing, its ownership (not the thing itself!) becomes programmable, verifiable, divisible, durable, universally addressable, composable, digitally secured, and easy to transfer. Bitcoin and other completely on-chain assets are provably scarce - scarcity is enforced by code and distributed consensus.

套利的本质

套利大行其道,那么套利是什么? 下面这张图是一个活生生的套利案例。 套利的本质是什么? 套利的本质是利用非对称获利 套利的竞争是发现非对称机会以及利

谈谈clubhouse

背景 最近clubhouse的邀请一码难求,自己有幸被邀请。体验一下,说一下自己对clubhouse一些想法。(Ps:由于区块链与加密货币的火

45 English sentence pattern

询问 who can who can help me move this box? who is who is that girl in blue? when can we when can we go hiking? When did you when did you come back? where is where is the washroom? where can I where can i find some bottled water? why do/did why did you quit your job? how did you How did you get to know each other?

Quotes From Albert Einstein

The difference between stupidity and genius is that genius has its limits. We all know that light travels faster than sound. That’s why certain people appear bright until you hear them speak. The only thing that interferes with my learning is my education. Education is what remains after one has forgotten everything he learned in school. The majority of the stupid is invincible and guaranteed for all time. The terror of their tyranny, however, is alleviated by their lack of consistency.

谈谈开放的重要性

说明 本文从软件,互联网,区块链,安全的视角谈谈开放的重要性。 软件 软件方面看几个例子吧。 首先看一下chrome浏览器,chrome浏览器首先建

那些值得多读的历史书

前言 历史是一面镜子。 历史是一个任人打扮的小姑娘。 “Most history is guessing, and the rest is prejudice.” 历史告诉我们过去发生什么,启示我们现在做什么,

说说计算思维

什么是计算思维 wiki对于计算思维定义如下: Computational thinking (CT) refers to the thought processes involved in formulating problems so their solutions can be represented as computational steps and algorithms.[1]In education, CT is a set of problem-solving methods that involve expressing problems and their solutions in ways that a computer could also execute.[2]It involves automation

学会背包问题,再也不怕动态规划 0-1背包

问题描述 Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays val[0..n-1] and wt[0..n-1] which represent values and weights associated with n items respectively. Also given an integer W which represents knapsack capacity, find out the maximum value subset of val[] such that sum of

谈谈GPT3

GPT-3 GPT-3全称是"General Pre-trained Transformer-3",对应中文翻译为:第三代通用预训练转换器。 其wiki定义

说说地摊经济

最近地摊经济火了,火遍了朋友圈,激活了段子手。 原因 受到疫情影响,国内与国际经济都受到很大的冲击,国内企业倒闭,减薪,缩员等现象也是时有出现。

第一性原理思考101

定义 第一性原理(First Principles)是指从基本原理出发进行思考和解决问题的方法。其具体含义可以概括为: 不做任何假设,客观看待问题

谈谈跳出框架思考

引子 先看一下这道数学题: 画直线经过下图中九个点,并且做到不重复经过任何一个点。 这里不是出题给大家做,只是引出话题。 下面是这个问题的答案: 这个