nonzero_ext/literals.rs
1//! Handling non-zero literal values.
2
3pub(crate) mod sealed {
4 use crate::NonZeroAble;
5
6 /// A trait implemented by all known integer literals that can
7 /// appear in source code.
8 pub trait IntegerLiteral: NonZeroAble {}
9}
10
11/// A representation of a non-zero literal. Used by the [`nonzero!`] macro.
12///
13/// This struct has no use outside of this macro (even though it can be constructed by anyone).
14/// It needs to exist to support the use of the [`nonzero!`] macro in const expressions.
15pub struct NonZeroLiteral<T: sealed::IntegerLiteral>(pub T);