solana-math 0.4.1

Checked arithmetic and conversion traits for Solana-oriented Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Host-only overflow diagnostics behind the `debug` feature.

/// Logs `message` with the caller's file/line when the `debug` feature is enabled.
///
/// No-op in the default `no_std` build. Requires `debug` (which enables `std`) for
/// `println!`
#[cfg(feature = "debug")]
#[inline(always)]
#[track_caller]
pub fn log(message: &str) {
    let caller = core::panic::Location::caller();
    println!("{message} at {}:{}", caller.file(), caller.line());
}

#[cfg(not(feature = "debug"))]
#[inline(always)]
pub fn log(_message: &str) {}