Expand description
doe is a feature-rich Rust utility crate — a Swiss-army knife for everyday development tasks. It bundles encoding helpers, cryptographic primitives, clipboard management, keyboard & mouse simulation, screenshot capture, HTTP & JSON utilities, date/time helpers, Excel & DOCX manipulation, structured logging, an async runtime, and much more. Every feature is opt-in via Cargo features so you only compile what you need.
§Quick start
[dependencies]
doe = { version = "1", features = ["ctf", "crypto", "date"] }use doe::utils; // always available, no feature needed
assert_eq!(utils::hex::encode(b"hi"), "6869");§Feature flags
| Feature | What it enables |
|---|---|
ctf | Hex, base64, URL, hashing, regex, Chinese text, HTML parsing |
clip | Clipboard read & write |
keyboard | Keyboard input simulation (press, release, combo) |
mouse | Mouse movement, click, drag, scroll |
kcm | Keyboard + clipboard + mouse (shorthand) |
crypto | AES, RSA, SHA-1/2/3, Blake3, SM2/3/4, MD5, RIPEMD-160 |
screenshot | Screen capture — Windows GDI / macOS CoreGraphics / Linux x11+Wayland |
images | Image resize, padding, ICO & ICNS conversion |
date | Date/time formatting, Excel serial-date conversion |
xlsx | Read & write .xlsx files (cell values, hyperlinks, formulas) |
docx | Read & write .docx files (text replace, content extraction) |
exiftool | EXIF / metadata extraction from photos & videos |
httprs | Simplified reqwest HTTP client (sync & async) |
json | json! macro, deserialise from &str, serialise to Vec<u8> |
asyncrs | Tokio multi-thread runtime + block_on + Command |
logger | Tracing-subscriber initialised with file appender & env-filter |
sqlserver | Deadpool + Tiberius connection pool for SQL Server |
axumserver | Pre-configured Axum HTTP server with CORS, TLS, rate-limit |
ip_addr | Local IP / interface discovery |
process | Enumerate running processes, kill by name or PID |
sys_random | Cryptographically secure random bytes & UUID v4 |
full | All of the above |
§Always available (zero features needed)
Even without any feature flag you get:
| Module | What it provides |
|---|---|
utils | hex, base64, percent-encoding, TempDir — pure-std helpers |
color | rgb_to_hex / hex_to_rgb |
fs | Walk, copy, move files & folders; append; read-only helpers |
system / command | Run shell commands, capture stdout/stderr |
rand | LCG pseudo-random generator |
macros | dprintln!, has_powershell!, hashmap! |
traits | DebugPrint, Sleep, Spawn, Fifo, StrExt |
timer | run_timer — schedule a closure on an interval |
zoml | ZOML ↔ CSV conversion |
structs | Bfn (buffered file), Bts (builder) |
consts | Common constants |
DynError | Result<T, Box<dyn Error>> alias |
generate_all_possible_vec / permutations | Combinatorics helpers |
§Minimum Supported Rust Version
MSRV: 1.73 (required for OnceLock and div_ceil used in utils).
Re-exports§
pub use consts::consts::*;pub use fs::fs::*;pub use macros::macros::*;pub use rand::rand::*;pub use structs::structs::*;pub use timer::impl_timer::*;pub use traits::traits::*;pub use zoml::zoml::*;
Modules§
- asyncrs
- Async runtime utilities for concurrent programming
- axumserver
- Axum web server utilities for building HTTP APIs
- clipboard
- Clipboard operations for copying and pasting data
- color
- Color format conversions between RGB and HEX
- consts
- Common constants used throughout the crate
- crypto
- Cryptographic functions including AES, RSA, SHA, MD5 and Blake3
- ctf
- ctf module provides utility functions like
permutations,hex_encode,hex_decode,base64_encode,base64_decode,php_urlencode,php_urldecode. convert_to_pinyin_with_non_chinese - date
- date module contains functions for get now,get_recent_seven_days,normal_date_to_excel_date,excel_date_to_normal_date
- docx
- xlsx module contains functions for reading editing docx file docx_replace
- exiftool
- exiftool module contains all utility macros for development
- fs
- The file system (fs) module provides functions and structs for performing operations on the file system. It includes functions for reading, writing, creating, and deleting files and directories.
- httprs
- reqwest module is easy way to use reqwest crate for http requests
- images
- images module contains functions resize add paddings,convert image format
- ip_addr
- IP address parsing and manipulation utilities
- json
- json module contains functions for reading, writing, and manipulating JSON files or content.
- keyboard
- keyboard module contains functions and structs related to keyboard input. It allows the user to simulate keyboard input, capture keystrokes, and perform other keyboard-related operations.
- logger
- logger module contains functions for logging
- macros
- macros module contains all utility macros for development
- mouse
- mouse module contains functions and structs related to mouse input. It allows the user to simulate mouse input, capture mouse movements and clicks, and perform other mouse-related operations.
- process
- get all process (name,pid) and kill process by name or pid
- rand
- Random number generation using Linear Congruential Generator (LCG)
- screenshot
- screenshot module contains functions for screenshot and get hex from screenshot image
- sqlserver
- SQL Server database operations including connection management and query execution
- structs
- structs module contains definitions of custom data structures like
Bfn,Bts,waker_fn. - sys_
random - generate random number with sys fn
Here’s a markdown documentation for the
sys_randommodule: - timer
- timer module provides functions and structs for creating and managing timers. It allows the user to schedule tasks to be executed at a specific time or interval.
- traits
- traits module contains trait definitions that define shared behavior and functions
- utils
- Utility module providing pure-std implementations of small encoding/temp
helpers (
hex,base64,percent,temp), so the crate no longer needs to depend on those external crates. - xlsx
- xlsx module contains functions and structs for reading, writing, and manipulating Excel files in the XLSX format.
- zoml
- zoml module contains functions for converting data between the ZOML format and CSV format.
Macros§
- args
- get argument and collect into Vec<String>
- as_to
- convert type
- bfn
- implments Bfn struct and bfn! macro for Box<dyn Fn()> trait object
- binary_
to_ decimal - convert binary string to decimal
- btreemap
- macro for BTreeMap
- bts
- implments Bts struct and bts! macro for Box<\dyn ToString> trait object
- deduped_
sorted - sorted and deduped Vec
- dyn_
error - has_
nightly_ compiler - has stable rust nightly return bool
- has_
powershell - has_
stable_ compiler - has stable rust compiler return bool
- hashmap
- macro for HashMap
- impl_
all - implement Default,Debug,Display,Clone,Drop for struct
- impl_
clone - implmemt Clone for Struct
- impl_
debug - implmemt Debug for Struct
- impl_
default - implmemt Default for Struct
- impl_
display - implmemt Display for Struct
- impl_
drop - implmemt Drop for Struct
- include_
string - input
- get user input from terminal,return String
- input_
lines - max
- expr return max value
- memory_
address - expr return memory address
- min
- expr return min value
- multiply_
matrix - mutiply two matrix
- powf
- returns a raised to the b power
- read_
csv - read .csv file and Collect into Vec<Vec<String>>
- remove_
file_ or_ folder - remove file or folder
- run_
time - set_
interval - run a function repeatedly, beginning after some millis, then repeating continuously at the given interval.
- set_
timeout - run a function once after a particularized delay(millis)
- snail_
sort - return the array elements arranged from outermost elements to the middle element, traveling clockwise (n x n)
- socketaddr
- socketaddr
- sorted
- sorted new Vec
- split_
to_ vec - Spliy &str by spliter and collect into Vec<String>
- system
- like pythons os.system() function
- system_
cmd - like pythons os.system() function
- targets
- implment targets! for return Vec<(Box<dyn ToString>,Box<dyn ToString>)>
- utc_
timestamp - get current UTC-timestamp
- vec_
element_ clone - clone element by index
- vec_
element_ convert - convert vec elements type
- vec_
element_ parse - parse Vec element to type, parse Vec<&str> Collect to Vec<type>
- vec_
element_ position_ all - find element position and collect into Vec
- vec_
element_ remove - find the fist element and remove
- vec_
element_ remove_ all - find the element and remove all
- vec_
element_ take - take size of elements and return a new vec
- vec_
element_ to_ string - convert vec item to String,return Vec<String>
- vec_
enumerate - enumerate all indexs and elements collect tuple of vec
- vec_
merge - Merge two Vec return merged Vec
- vec_
slice - slice vec by range
- vec_
sort - sort vec and return sorted vec
- vec_
type - get vec type ,return string type value
- vec_zip
- zip two vec elements in tuple
Structs§
- Command
Out - CommandOut struct is used to store the output and error of a command execution.
- Command
Result - CommandResult
Constants§
- MAX_
CMD_ OUTPUT_ SIZE - max_cmd_output_size
Traits§
- Command
Helper - CommandHelper trait is used to run external commands and return their output and error.
Functions§
- command
- Runs a shell command and returns its captured output, error and status.
- digits
- digits
- execute_
command - execute_command
- generate_
all_ possible_ vec - The Vec sort all elements can be repeated to define the longest shortest size
- letters_
and_ digits - letters_and_digits
- lowercase_
letters - lowercase_letters
- permutations
- permutations
- system
- Rust is a wrapper for the standard library’s std::process::Command function, which is used to execute external commands
- uppercase_
letters - uppercase_letters
Type Aliases§
- DynError
- Rust is a wrapper for the standard library’s std::error::Error trait, which is used to define the behavior of types that can be used for error handling. It provides a way to represent errors in a consistent and type-safe manner.