File Extension
Rust files must use the.rs extension:
Compilation
Rust files are compiled usingcargo with a special workflow:
Compilation Process
- Copy source file to
~/.quicktest/rust/src/main.rs - Build with cargo using the release profile for optimizations
- Copy binary from the target directory to
.qt/main
Quick Test CLI uses a pre-configured Cargo project in
~/.quicktest/rust/ to manage Rust dependencies.Execution
After compilation, the binary is executed with:Configuration File
The Cargo configuration is located at~/.quicktest/rust/Cargo.toml:
Available Dependencies
The default configuration includes common competitive programming libraries:- proconio - Fast and convenient input parsing
- num - Numeric types and traits
- rand - Random number generation
- regex - Regular expressions
- num-bigint - Arbitrary precision integers
Example Code
Here’s a typical Rust solution for competitive programming:Usage with Quick Test
Compare Mode (cmp)
Compare your solution against a brute-force correct solution:Stress Testing Mode
Test your solution’s performance:Checker Mode
For problems with multiple valid answers:Requirements
Verify your installation:Installing Rust
If you don’t have Rust installed, visit rustup.rs for installation instructions.Using Proconio for Input
Theproconio crate provides a convenient macro for reading input:
Proconio automatically handles whitespace and newlines, making input parsing much simpler than using standard Rust I/O.
Performance
Rust’s compiled binaries are highly optimized and perform comparably to C++. The--release flag ensures all optimizations are enabled.
Platform Support
- Linux: Full support
- Windows: Full support
- macOS: Full support