Skip to main content

Crate doe

Crate doe 

Source
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

FeatureWhat it enables
ctfHex, base64, URL, hashing, regex, Chinese text, HTML parsing
clipClipboard read & write
keyboardKeyboard input simulation (press, release, combo)
mouseMouse movement, click, drag, scroll
kcmKeyboard + clipboard + mouse (shorthand)
cryptoAES, RSA, SHA-1/2/3, Blake3, SM2/3/4, MD5, RIPEMD-160
screenshotScreen capture — Windows GDI / macOS CoreGraphics / Linux x11+Wayland
imagesImage resize, padding, ICO & ICNS conversion
dateDate/time formatting, Excel serial-date conversion
xlsxRead & write .xlsx files (cell values, hyperlinks, formulas)
docxRead & write .docx files (text replace, content extraction)
exiftoolEXIF / metadata extraction from photos & videos
httprsSimplified reqwest HTTP client (sync & async)
jsonjson! macro, deserialise from &str, serialise to Vec<u8>
asyncrsTokio multi-thread runtime + block_on + Command
loggerTracing-subscriber initialised with file appender & env-filter
sqlserverDeadpool + Tiberius connection pool for SQL Server
axumserverPre-configured Axum HTTP server with CORS, TLS, rate-limit
ip_addrLocal IP / interface discovery
processEnumerate running processes, kill by name or PID
sys_randomCryptographically secure random bytes & UUID v4
fullAll of the above

§Always available (zero features needed)

Even without any feature flag you get:

ModuleWhat it provides
utilshex, base64, percent-encoding, TempDir — pure-std helpers
colorrgb_to_hex / hex_to_rgb
fsWalk, copy, move files & folders; append; read-only helpers
system / commandRun shell commands, capture stdout/stderr
randLCG pseudo-random generator
macrosdprintln!, has_powershell!, hashmap!
traitsDebugPrint, Sleep, Spawn, Fifo, StrExt
timerrun_timer — schedule a closure on an interval
zomlZOML ↔ CSV conversion
structsBfn (buffered file), Bts (builder)
constsCommon constants
DynErrorResult<T, Box<dyn Error>> alias
generate_all_possible_vec / permutationsCombinatorics 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_random module:
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§

CommandOut
CommandOut struct is used to store the output and error of a command execution.
CommandResult
CommandResult

Constants§

MAX_CMD_OUTPUT_SIZE
max_cmd_output_size

Traits§

CommandHelper
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.