js 录音文本报价计算

js 录音文本报价计算

<div class="pc div1"> 您的内容包含: 数字:<span class="js-spn">0</span>个 英文:<span class="js-spn">0</span>个 汉字:<span class="js-spn">0&l...

前端 2023-03-11 AM 1034℃ 0条
rust UdpSocket 通信

rust UdpSocket 通信

use std::net::UdpSocket; use std::str; fn main() -> std::io::Result<()> { let remote_addr = "localhost:8888"; let socket = UdpSocket::bind("localhost:0")?; println!("Sending to the server"); socket.send_to("Hello from client".as_b...

Rust 2023-03-11 AM 966℃ 0条
rust 复制文本文件

rust 复制文本文件

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]; let mut file = File::open(src)?; let mut new_file = File::create(dest)?; io::copy(&...

Rust 2023-03-10 PM 1492℃ 0条
rust 创建zip压缩包并写入文本

rust 创建zip压缩包并写入文本

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.start_file("file.txt", zip::write::FileOptions::default())?; zip.write_all(b"zip...

Rust 2023-03-10 PM 1036℃ 0条
rust写个简单爬虫

rust写个简单爬虫

Cargo.toml 配置[dependencies] scraper = "0.12.0" reqwest = { version = "0.11.10", features = ["blocking", "json"] } surf = "2.3.2" tokio = { version = "1.17.0", features = ["full"] } futures = "0.3.21" main.rs代码use fu...

Rust 2023-03-10 AM 962℃ 0条
rust 逐行读取文本

rust 逐行读取文本

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(file); for line in fin.lines() { println!("{}", line.unwrap()); } }

Rust 2023-03-10 AM 871℃ 0条
Rust Cargo 指定国内镜像

Rust Cargo 指定国内镜像

参考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/lernaean-deploy如当前用户目录为/root 项目目录为/root/rust-test 则在 /root/.cargo 目录或 /root/rust-test/.cargo 目录 创建文件config...

Rust 2023-03-08 PM 1187℃ 0条
Rust 文件批量添加换行符

Rust 文件批量添加换行符

本文代码 https://github.com/tothis/rust-record/tree/main/cli/file-append-newlineCargo.toml[package] name = "file-append-newline" version = "0.1.0" authors = ["Li Lei <this.lilei@gmail.com>"] edition = "2021" [dependencies] toml = "0.5" serde = ...

Rust 2023-03-08 PM 1102℃ 0条
Rust 日期时间命令行工具

Rust 日期时间命令行工具

Rust 日期时间命令行工具本文代码 https://github.com/tothis/rust-record/tree/main/cli/time当前日期和时间戳cargo run解析时间cargo run "2020-02-20 02:04:08.000"解析时间戳cargo run 1582135448000Cargo.toml[package] name = "time" version = "0.1.0" authors = ["Li Lei <this.lilei@gmail.com>"] editio...

Rust 2023-03-08 PM 1086℃ 0条
Rust SSH 操作 执行远程命令 上传下载文件

Rust SSH 操作 执行远程命令 上传下载文件

本文代码 https://github.com/tothis/rust-record/tree/main/test/ssh2Cargo.toml[package] name = "ssh2-record" version = "0.1.0" edition = "2018" [dependencies] ssh2 = "0.9" src/main.rsuse std::fs; use std::io::{Read, Write}; use std::net::TcpStream; use std::path...

Rust 2023-03-08 PM 1566℃ 0条
rust使用curl下载文件并打印下载进度

rust使用curl下载文件并打印下载进度

增加依赖:easy="*"use curl::easy::Easy; use std::fs::File; use std::io::Write; fn main() { let source_url = "https://pic.3gbizhi.com/2019/0927/20190927085959737.jpeg"; let collect:Vec<&str> = source_url.split("/").collect(); let file_path = collect[colle...

Rust 2023-03-08 PM 1136℃ 0条