diff --git a/howto.md b/howto.md new file mode 100644 index 0000000..4be78a6 --- /dev/null +++ b/howto.md @@ -0,0 +1,68 @@ + +# Backend internal interview (rust) - improved + +## How to used + +**cargo run --** can be replaced for generated binaries with + +- target/debug/be-technical-interview-rust (for debug build) +- target/release/be-technical-interview-rust (for release build) + +### For help + +```bash +cargo run -- -h +``` + +### For input file **input.txt** + +```bash +cargo run -- -i input.txt +``` + +### In quiet mode + +```bash +cargo run -- -i input.txt -q +``` + +if **output path** is provided, results will be saved in provided path,
+without **quiet mode** info is printed to terminal + +```bash +cargo run -- -i input.txt -o /tmp/output.txt +``` + +### Use config path. **Batch processing in parallel** (one thread for each target) + +```bash +cargo run -- -c config.toml +``` + +### Config file content + +```toml +be_quiet = false +[[targets]] +input = "input.txt" + +[[targets]] +input = "input_2.txt" +``` + +If **output** path is provided, **out_overwrite** can be used (true or false) to append conten or rewrite. + +By default: + +- **out_overwrite** is **true** +- *reg_exp** is set as + +```rust +pub const DEFAULT_REG_EXP: &str = r"(\d+) (\w+) (\d+)"; +``` + +**reg_exp** can be provided but as a **regex** expresion from **string**, if it can not be converted parser exit. + +> [!CAUTION] +> Command line options have precedence over **config path** settings.
+> Be careful with the combinations diff --git a/layout.md b/layout.md new file mode 100644 index 0000000..b8fe449 --- /dev/null +++ b/layout.md @@ -0,0 +1,38 @@ + +# Backend internal interview (rust) - improved + +Files layout + +```markdown +. +├── ABOUT.md [Verification](ABOUT.md) +├── Cargo.lock +├── Cargo.toml +├── CHANGES.md [Changes](CHANGES.md) +├── Home-Task_exercise_interview_Rust.pdf +├── LICENSE +├── README.md +├── assets [Assets files for rustdoc](assets) +│   ├── doc.css +│   ├── header.html +│   └── howto.md +├── howto.md [How to use](howto.md) +├── input.txt +├── input_2.txt [Second input for parallel](input2.txt) +├── layout.md [Files layout](layout.md) +├── output_expected.txt +└── src [source code](src) +   ├── defs +   │   ├── cli.rs +   │   ├── config.rs +   │   ├── metric_data.rs +   │   └── metrics.rs +   ├── defs.rs +   ├── main.rs +   ├── metrics_consumer.rs +   └── tests.rs +``` + +**.cargo** for **rustdoc** documentation build. +**.gitignore** to exclude paths like **target** +