Crate ruc[][src]

RUC

A useful util-collections for Rust.

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 native-local-datatime(+8)

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

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 +8 datetime’