nonmax
nonmax provides types similar to the std NonZero*
types, but instead requires
that their values are not the maximum for their type. This ensures that
Option<NonMax*>
is no larger than NonMax*
.
nonmax supports every type that has a corresponding non-zero variant in the standard library:
NonMaxI8
NonMaxI16
NonMaxI32
NonMaxI64
NonMaxI128
NonMaxIsize
NonMaxU8
NonMaxU16
NonMaxU32
NonMaxU64
NonMaxU128
NonMaxUsize
Example
use ;
let value = new.expect;
assert_eq!;
assert_eq!;
let signed = new.expect;
assert_eq!;
assert_eq!;
let oops = new;
assert_eq!;
Features
-
std
(default): implements [std::error::Error
] for [ParseIntError
] and [TryFromIntError
]. Disable this feature for#![no_std]
support. -
serde
: implements theSerialize
andDeserialize
traits fromserde
.
Minimum Supported Rust Version (MSRV)
nonmax supports Rust 1.47.0 and newer. Until this library reaches 1.0, changes to the MSRV will require major version bumps. After 1.0, MSRV changes will only require minor version bumps, but will need significant justification.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.