Skip to main content

Crate cba

Crate cba 

Source
Expand description

A collection of utilities which wrap common tasks needed in cli utilities Results/Options are downgraded to Options/bools by handling errors within the wrappers using bog.

§Error handling strategies:

§Macros

Unwrap errors from Result/Option with (get/unwrap_or) and immediately return

§BogOkExt

Downgrade errors to options by bogging the error

§BogUnwrapExt

Unwrap infallible errors or bog and exit process

§Misc

A prefix can be added to the error with prefix_err

§Additional

These functions are mostly not composable

Re-exports§

pub use bog::BOGGER;

Modules§

baccarat
bait
bath
Path manipulation
bo
IO
bog
Display colored log-style messages for CLI tools Performance is no concern (hence bog), only convenience and style.
bother
broc
Utilities for (spawning) processes
bs
Filesystem set, check, read
bum

Macros§

_dbg
dbg!/log::debug! and return the value.
_eprint
Prints to stderr like eprintln! but only in debug builds
_ibog
_info
Info log in debug
_wbog
auto_impl
cbog
concat_
dbog
define_collection_wrapper
Implement a wrapper around a container type (i.e. HashMap). Implements the Deref, DerefMut, Default and IntoIterator/FromIterator traits and the new function.
define_const_default
define_either
Macro to define an Either enum with exactly two variants: Left, Right.
define_restricted_wrapper
Implement a restricted wrapper around an inner type:
define_transparent_wrapper
Implement a transparent wrapper around an inner type:
define_when
Macro to define a When enum with exactly three variants: Never, Auto, Always. Preserves enum and variant metadata.
ebog
env_vars
expr_as_path_fn
Cache the expression into a fn() -> &’static Path
ibog
mbog
nbog
prints
Write newline-delimited strings directly to stdout without dynamic dispatch.
slice_
Map a function over the elements of a []. By default, .to_string() is applied. To specify the mapping, a function or type followed by | can precede the elements. The pure prefix : is shorthand for calling .into().
unwrap
Examples
vec_
Map a function over the elements of a vec![]. By default, .to_string() is applied. To specify the mapping, a function or type followed by | can precede the elements. The pure prefix : is shorthand for calling .into().
wbog

Structs§

StringError