Crate ovr_ruc

Source
Expand description

§RUC

A useful util-collections for Rust.

[features]
default = ["ansi"]
ansi = []
compact = []

rich = ["uau", "cmd"]
uau = ["nix", "rand"]
cmd = []

§Example

use ruc::{err::*, *};

#[derive(Debug, Eq, PartialEq)]
struct CustomErr(i32);

fn will_panic() {
    let l1 = || -> Result<()> { Err(eg!("The final error message!")) };
    let l2 = || -> Result<()> { l1().c(d!()) };
    let l3 = || -> Result<()> { l2().c(d!("A custom message!")) };
    let l4 = || -> Result<()> { l3().c(d!("ERR_UNKNOWN")) };
    let l5 = || -> Result<()> { l4().c(d!(@CustomErr(-1))) };

    pnk!(l5());
}

Re-exports§

pub use err::*;

Modules§

err
RucError

Macros§

alt
optimize readable in high-level-functions
d
print debug-info, eg: modular and file path, line number …
datetime
get current DateTime
die
Just a panic
eg
Generate error with debug info
info
print infomation only
info_omit
drop the result afeter printing the message
map
map operations
max
find the max value of multi values
min
find the min value of multi values
omit
omit the result without printing any message
pd
print msg those impl fmt::Display
pnk
Print log, and panic
sleep_ms
Sleep in milliseconds
ts
get current UTC-timestamp
vct
vector operations

Functions§

gen_datetime
generate a ‘formated DateTime’