Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
criterion 0.5.1 - Docs.rs
[go: Go Back, main page]

criterion 0.5.1

Statistics-driven micro-benchmarking library
Documentation
//! Private macro used for error handling.

/// Logs an error, ignores an `Ok` value.
macro_rules! log_if_err {
    ($x:expr) => {
        let closure = || {
            try_else_return!($x);
        };
        closure();
    };
}

/// Matches a result, returning the `Ok` value in case of success,
/// exits the calling function otherwise.
/// A closure which returns the return value for the function can
/// be passed as second parameter.
macro_rules! try_else_return {
    ($x:expr) => {
        try_else_return!($x, || {})
    };
    ($x:expr, $el:expr) => {
        match $x {
            Ok(x) => x,
            Err(e) => {
                crate::error::log_error(&e);
                let closure = $el;
                return closure();
            }
        }
    };
}

/// Print an error message to stdout. Format is the same as println! or format!
macro_rules! error {
    ($($arg:tt)*) => (
        println!("Criterion.rs ERROR: {}", &format!($($arg)*))
    )
}

/// Print a debug message to stdout. Format is the same as println! or format!
macro_rules! info {
    ($($arg:tt)*) => (
        if $crate::debug_enabled() {
            println!("Criterion.rs DEBUG: {}", &format!($($arg)*))
        }
    )
}