CLI Batteries
Opinionated batteries-included command line interface runtime utilities.
To use it, add it to your Cargo.toml
[]
= "0.1"
[]
= "0.1"
and call the [build_rs
] function in your build.rs
Then in your src/main.rs
you define app specific command line arguments using [clap::Parser
][clap] and run the app as follows
use ;
use ;
use File;
async
You can see this working in the example project.
Features
signals
: Handle Ctrl-C, SIGINT and SIGTERM with gracefull shutdown.mimalloc
: Use the mimalloc allocator with security hardening features enabled.rand
: Log and configure random seeds.rayon
: Log and configure number of threads.prometheus
: Start a Prometheus metrics server.metered-allocator
: Collect metric on memory allocation, enablesprometheus
.mock-shutdown
: Enable thereset_shutdown
function that allows re-arming shutdown for testing.tokio-console
: Enable the--tokio-console
option to start a Tokio console server onhttp://127.0.0.1:6669/
for async inspection.otlp
: Enable the--trace-otlp
option to push traces to an OpenTelementry collector.
Building and testing
Format, lint, build and test everything (I recommend creating a shell alias for this):
&&\
&&\
&&\
&&\
Check documentation coverage
RUSTDOCFLAGS="-Z unstable-options --show-coverage"
To do
Goals:
Maybe: