How can I use regular expressions in Rust without Cargo?

I wrote some small scripts in Rust. They can be started using a command like

$ rustc dosomething.rs && ./dosomething

They work great. However, I came across a situation where I needed to use regular expressions. I started the script with extern crate regex;Looks like it means I need to run my script through Cargo. The only way I was able to run this tiny script using regular expressions was to force my script into its own directory with the following structure:

.
├── Cargo.toml
└── src
    └── main.rs

I downloaded Cargo.tomlusing

[package]
name = "wordcount"
version = "0.0.1"

[dependencies]
regex = "0.1"

and obediently ran cargo buildand got my executable executable.

, Cargo, , 17 , 21 23 .

; Java-, Maven , 23M .

, , Rust. (, - \pL.)

Rust - wordcount script , ? - -L, ?

+4
1

Rust

, regex () ( std?) Rust.

- wordcount script , ?

Cargo , . src/bin.

+1

All Articles