rust chksum-md5库 实现获取文件md5值

rust chksum-md5库 实现获取文件md5值

[dependencies] chksum-md5 = "0.0.0" use chksum_md5 as md5; let file = File::open(path)?; let digest = md5::chksum(file)?; assert_eq!( digest.to_hex_lowercase(), "5c71dbb287630d65ca93764c34d9aa0d" );

Rust 2024-03-02 PM 142℃ 0条
Rust读取excel文件的库

Rust读取excel文件的库

Rust是一款新型的、主打安全的语言。但是,百度上搜索读取excel的库还很难找。不过,我找到了一款,推荐给大家:ooxml, 当前版本0.2.7.这是依赖:[dependencies] ooxml = "0.2.7" itertools = "0.11.0" 具体代码如下:use ooxml::document::SpreadsheetDocument; fn main() { let filename = "F:/programWorks/Java/demo4cupdata/demoB.xlsx"; ...

Rust 2024-02-29 PM 141℃ 0条
rust 获取和设置鼠标位置

rust 获取和设置鼠标位置

#[cfg(windows)] extern crate winapi; fn set_cursor_pos(x: i32, y: i32) -> bool { use winapi::um::winuser::SetCursorPos; let ret = unsafe { SetCursorPos(x, y) }; ret == 1 } fn get_cursor_pos() -> Option<(i32, i32)> { use winapi::shared::windef::POINT; use win...

Rust 2024-02-27 PM 141℃ 0条
php微信域名拦截检测

php微信域名拦截检测

<?php /** * 微信域名拦截检测 * 2024年2月1日编写 * 作者:TANKING */ // 页面编码 header("Content-type:application/json"); // 获取Url $url = $_GET['url']; if($url) { // 调用官方接口 $checkUrl = 'https://cgi.urlsec.qq.com/index.php?m=url&a=validUrl&url='.urlencode($url); $ch = cu...

PHP 2024-02-24 PM 154℃ 0条
Rust 屏幕截图

Rust 屏幕截图

截屏https://github.com/nashaofu/screenshots-rs添加依赖[dependencies]screenshots = "0.5.3"use screenshots::Screen; use std::{fs, time::Instant}; fn main() { let mut start; let screens = Screen::all().unwrap(); fs::create_dir_all("D:/Test/").unwrap(); for screen in screens { ...

投资 2023-05-15 PM 2224℃ 0条
rust 延时 500毫秒

rust 延时 500毫秒

要在 Rust 中延迟执行代码,您可以使用 std::thread::sleep() 函数。这个函数接受一个时间量参数,表示需要等待的时间长度。下面是一个示例代码,将延迟 500 毫秒(0.5 秒):use std::{thread, time}; fn main() { let duration = time::Duration::from_millis(500); thread::sleep(duration); } 以上代码中,time::Duration::from_millis(500) 会创建一个表示 500 毫秒的持续时间对象,然后将其传递给 thread...

Rust 2023-05-15 PM 2118℃ 0条
rust 实现命令行程序 运行 不显示 窗口

rust 实现命令行程序 运行 不显示 窗口

如果你想在 Windows 操作系统上使用 Rust 编写一个命令行程序,并且不想让窗口显示出来,你可以使用 windows::windows_subsystem 模块,将子系统定义为 "windows",如下所示:#![windows_subsystem = "windows"] fn main() { // 在此处编写代码 } 当你构建并运行该程序时,它将终止掉,但是没有窗口显示。请注意,这只能在 Windows 平台上工作。如果你要开发跨平台命令行程序,则需要考虑其他方法来隐藏窗口,因为 Linux 或 macOS 不存在 Windows 子系统的概念...

Rust 2023-05-15 PM 1835℃ 0条
php 百度翻译代码

php 百度翻译代码

<?php /*************************************************************************** * Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved * **************************************************************************/ /** * @file baidu_transapi.php * @author mouyantao(mouyantao@baidu.co...

PHP 2023-05-04 PM 1296℃ 0条
php  MagicCrypt 加密解密 与 rust  MagicCrypt 通用

php MagicCrypt 加密解密 与 rust MagicCrypt 通用

PHP用到mcrypt模块来实作AES,因此需要激活mcrypt模块在线MagicCrypt加密解密 http://www.txttool.com/t/?id=NjA2<?phpnamespace org\magiclen\magiccrypt; class MagicCrypt { private $iv; private $key; private $bit; public function __construct($key = '', $bit = 128, $iv = '') { switch ($bit) { ...

PHP 2023-05-04 AM 1384℃ 0条
rust reqwest交叉编译错误 error: failed to run custom build command for `openssl-sys v0.9.63`

rust reqwest交叉编译错误 error: failed to run custom build command for `openssl-sys v0.9.63`

windows下 编译报错error: failed to run custom build command for openssl-sys v0.9.63解决办法:1.安装opensslWindows下:https://slproweb.com/products/Win32OpenSSL.html网站下载https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe或https://slproweb.com/download/Win32OpenSSL-1_0_2u.exeLinux下:centos: yum install -y openss...

Rust 2023-04-24 PM 2190℃ 0条
rust 保存文本 使用Windows(CRLF)格式

rust 保存文本 使用Windows(CRLF)格式

您可以在Rust中使用标准库中的std::fs模块来保存文本文件,并且在Windows上使用CRLF行尾。下面是一个基本示例:rustuse std::fs::File; use std::io::{BufWriter, Write}; fn main() { // 创建一个新文件并打开它以进行写入 let file = File::create("example.txt").unwrap(); // 使用 BufWriter 来缓冲写入操作 let mut writer = BufWriter::new(file); ...

Rust 2023-04-24 PM 900℃ 0条