pos

Macro pos 

Source
macro_rules! pos {
    ($val:expr) => { ... };
}
Expand description

Macro for creating a Positive value from the given expression.

Returns Ok(Positive) if the value is valid and non-negative, otherwise returns Err(PositiveError).

ยงExample

use positive::pos;

let valid = pos!(5.0);
assert!(valid.is_ok());

let invalid = pos!(-5.0);
assert!(invalid.is_err());