| Crates.io | cargo-rush |
| lib.rs | cargo-rush |
| version | 0.0.2 |
| created_at | 2024-12-06 19:18:29.379734+00 |
| updated_at | 2024-12-11 09:34:57.635731+00 |
| description | cargo run whatever is on the operating system clipboard. |
| homepage | https://github.com/cryptopatrick/cargo-rush |
| repository | https://github.com/cryptopatrick/cargo-rush |
| max_upload_size | |
| id | 1474571 |
| size | 22,619 |
When you're in a rush and don't feel like creating a rust file to test out
small snippets of simple Rust code - simply copy the Rust code to the operating system's clipboard, next, open a terminal and run cargo rush.
Let's say that we copy the lines below to the clipboard (operating system memory).
fn main() {
let a = 1;
let b = 2;
println!("{} + {} = {}", a, b, a + b);
}
In the terminal:
cargo install cargo-rush
cargo rush
# The command will call `rustc` on whatever is in the clipboard:
1 + 2 = 3
cargo rush can also run unit tests by using the -t flag.
Let's say we have the following code on the OS clipboard:
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
fn main() {
println!("Hello world");
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}