Crate 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

RucError

Macros

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

Functions

generate a ‘formated DateTime’