macro_rules! pos_or_panic {
($val:expr) => { ... };
}Expand description
Macro for creating a new Positive value that panics on invalid input.
Use this macro when you are certain the value is valid and want to
avoid handling the Result. For safer alternatives, use pos!() which
returns Result<Positive, PositiveError>.
§Panics
This macro will panic if the provided value cannot be converted to a Positive value
(e.g., negative numbers or values that cannot be represented as Decimal).
§Example
use positive::pos_or_panic;
let value = pos_or_panic!(5.0);
assert_eq!(value.to_f64(), 5.0);