Expand description
A collection of simple tools in Rust as Rust modules:
crate::arg::DumbArgParser: A simple argument parser.crate::progress::DumbProgressIndicator: A simpleIteratorwrapper that helps to show progress of iteration.crate::json::DumbJsonProcessor: A simple JSON processor / stream parser. It can be useful for handling command line argument parsing.crate::calc::DumbCalcProcessor: A simple infix calculation processor.crate::calculator::DumbCalculator: A simple calculator that accepts input keys acting like a real calculator. It can be used to implement a simple calculator UI.crate::ltemp::DumbLineTemplate: A simple line template for formatting a line, which can be use to print values as a line with some template.crate::lblscreen::DumbLineByLineScreen: A terminal / text-based “screen” update helper, which is extended fromcrate::ltemp::DumbLineTemplate, and should be helpful in managing the updates of the formatted lines that acts as a “screen”.
For a demo program of using the tools, you may want to run the included demo function demo::run_demo like
use rusty_dumb_tools::demo;
// demo::run_demo(None); // get arguments from command-line
demo::run_demo(Some(vec!["calc", "-h"])); // pass in explicit arguments Assuming new Rust project with main.rs like
use rusty_dumb_tools::demo;
fn main() {
demo::run_demo(None);
}the demo can be cargo run like
cargo run -- -hcargo run -- calc -hcargo run -- calc 1.1 + 2.2 * (4.3 - 2.4) + 5cargo run -- calc-replcargo run -- ltemp Trevorcargo run -- lblscreencargo run -- arg -f 0.2 5 --string2 VAL1 false 1 2 3
You may also want to visit the source in rusty_dumb_tools GitHub repo
Enjoy!
Greeting from the author Trevor Lee:
Peace be with you! May God bless you! Jesus loves you! Amazing Grace!
Modules§
- arg
- A simple argument parser –
crate::arg::DumbArgParser - calc
- A simple infix calculation processor –
crate::calc::DumbCalcProcessor - calculator
- A simple calculator that accepts input keys acting like a real calculator. It is base on
crate::calc::DumbCalcProcessorfor it’s calculation processing. - demo
- Home for
rusty_dumb_toolsdemo, and sub-demos for the various tools included in this crate. Please refer tocrate::demo::run_demo. - json
- A simple JSON processor / stream parser –
crate::json::DumbJsonProcessor - lblscreen
- A simple terminal / text-based “screen” update helper –
crate::lblscreen::DumbLineByLineScreen - ltemp
- A simple line template for formatting a line, which can be use for printing values as a line with some template –
crate::ltemp::DumbLineTemplate - prelude
- All the common ‘uses’ of this crate –
use rusty_dumb_tools::prelude::*; - progress
- A simple
Iteratorwrapper that helps to show progress of iteration –crate::progress::DumbProgressIndicator - shared
- Things shared by the different tools of this crate.
Macros§
- dap_arg
- use this macro to create a
DumbArgBuilderinstance to build argument object (argument specification) to be added toDumbArgParserwithDumbArgBuilder::add_tothe macro accepts one for more strings (positional argument name or flags) like - dlt_
comps - use this macro to compose
DumbLineTemplatecomponents - dltc
- use this macro to construct a value-mapped
DumbLineTemplatecomponent (aMappedLineTempCompBuilderto be precise), and it is expected to be use together withdlt_comps! - dpi_
into_ iter - use this macro to wrap a Vec
into_iter()with DumbProgressIndicator to show progress of iteration - dpi_
iter - use this macro to wrap a Vec
iter()with DumbProgressIndicator to show progress of iteration - dpir
- use this macro to wrap a Range with DumbProgressIndicator to show progress of iteration
- dpiw
- use this macro to wrap an Iterator with DumbProgressIndicator to show progress of iteration
- sap_arg
- please consider using the macro
crate::dap_arg!instead, since this macro will be deprecated