2016-8-15 22:27 /
When studying a new language,there will be a problem.You may know how to do it but do not know what it is. I write this because when  I learn more I can look back,If someone find some problem in this note,please let me know,thanks.

First, I use Cargo to manage my code's vision and libs. Now all I know about Cargo is

Cargo build
to compile the code,


Cargo go
to run the code,

Cargo update
to update the libs's vision to the next vision.

When I use the Cargo,because of the GFW,I can't update the libs.I used shadowsocks to across the GFW,but shadowsocks use the socks5 protocol so that we can not across the GFW in terminal.I search by Google and know a software named privoxy,which can turn sock5 to https.

I do not know how to do this so I just followed this web

https://blog.phpgao.com/privoxy-shadowsocks.html

cd /usr/local/etc/privoxy

vi config

listen-address  192.168.1.1:8118

Forward sock5 /127.0.0.1:1080.

/etc/init.d/privoxy restart







export http_proxy=http://192.168.1.1:8118

export https_proxy=http://192.168.1.1:8118






Now I can update the libs.

The first example that I meet is"Guessing game"

In this example, there are someing I can use but do not know what it is

rand::thread_rng()gen_range(1,101)


can find a number from 1 to 100 randomly

match "A".cmp(&"B"){

Ordering::Less=>

Ordering::Greater=>

Ordering:Equal=>
can compare two numbers

.trim()
can remove the whitespace and \n

.parse()
can turn String to number (i32 u32 i64 u64)
Tags: program