use rand::prelude::*; fn main() { let secret = rand::thread_rng().gen_range(0..101); println!("神秘数字是:{}", secret); }
use std::cmp::Ordering;use std::io; fn main() { println!("请输入路径:"); let mut guess = String::new(); io::stdin().read_line(&mut guess).expect("读取异常");...
use std::fs; fn main() -> std::io::Result<()> { // 创建文件夹 fs::create_dir("setting")?; // 一次创建多级文件夹 fs::create_dir_all("setting/myapp/networksettings")?...
use std::fs; use std::io::{self, Write}; //文件创建/导入 // 写入 fn open() -> std::io::Result<()> { let mut file = fs::File::create("textfile.txt")?; file.write_all(b"New ...
use std::net::UdpSocket; use std::str; fn main() -> std::io::Result<()> { let remote_addr = "localhost:8888"; let socket = UdpSocket::bind("localhost:0")?; ...
use std::env; use std::fs::File; use std::io; fn main() -> io::Result<()> { let args: Vec<_> = env::args().collect(); let src = &args[1]; let dest = &args[2]; ...
use std::fs::File; use std::io; use std::io::Write; fn main() -> io::Result<()> { let file = File::create("file.zip")?; let mut zip = zip::ZipWriter::new(file); zip...
Cargo.toml 配置[dependencies] scraper = "0.12.0" reqwest = { version = "0.11.10", features = ["blocking", "json"] } surf = "2.3.2" tokio = { version ...
use std::io::prelude::*; use std::fs::File; use std::io::BufWriter; use std::io::BufReader; fn main() { let file = File::open("./ico.txt").unwrap(); let mut fin = BufReader::new(...
参考https://huangjj27.gitlab.io/posts/rust-mirrorhttps://doc.rust-lang.org/cargo/reference/source-replacement.htmlhttps://lug.ustc.edu.cn/wiki/mirrors/help/rust-crateshttps://github.com/rustcc/lernae...