TAO 标准库全文档

std::io 控制台IO

use std::io;
fn main(){
    let mut buf = String::new();
    io::stdin().read_line(&mut buf);
    println(buf);
}

std::fs 文件读写

use std::fs;
// 写入文件
fs::write("test.txt","hello tao");
// 读取文件
let s = fs::read_to_string("test.txt");

std::net TCP网络

// 简易TCP客户端
use std::net::TcpStream;
let conn = TcpStream::connect("127.0.0.1:8080");

std::collections 容器

内置Vec(动态数组)、HashMap、HashSet、Deque等常用容器。

use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(1,"tao");

std::thread 多线程

use std::thread;
thread::spawn(||{
    println("sub thread run");
}).join();