- tcpserver is a simple TCP response server which can print message at server console and echo it to client. I build this project for my homeworks of studying substrate development.
- Implement a simple echo tcp server with Rust std library 2022-07-08
- Implement three example code for traffic light, sum some u32 values and use generic and trait feature
xionggang@DESKTOP-5HGRQV2:~/rust/projects/tcpserver$ cargo build --release
xionggang@DESKTOP-5HGRQV2:~/rust/projects/tcpserver$ cd target/releases
xionggang@DESKTOP-5HGRQV2:~/rust/projects/tcpserver$ ./tcpserver
The first question is the time of the different color traffic light:
--------------------------------------------------------------------
Red light time is 30
Yellow light time is 5
Green light time is 45
--------------------------------------------------------------------
The second question is summing of vec u32 values:
--------------------------------------------------------------------
Total value is :Some(3446353557)
overflow!
Wrong value is :None
--------------------------------------------------------------------
The third question is use generic and trait feature to calculate area of shapes:
--------------------------------------------------------------------
The shape area is 314
The shape area is 25
The shape area is 100
--------------------------------------------------------------------