1#![no_std]
46#![forbid(unsafe_code)]
47#![warn(missing_docs)]
48#![cfg_attr(feature = "strict", deny(missing_docs))]
49#![cfg_attr(feature = "strict", deny(warnings))]
50#![cfg_attr(
51 feature = "cargo-clippy",
52 allow(
53 clippy::len_without_is_empty,
54 clippy::many_single_char_names,
55 clippy::new_without_default,
56 clippy::suspicious_arithmetic_impl,
57 clippy::type_complexity,
58 clippy::wrong_self_convention,
59 )
60)]
61#![cfg_attr(feature = "cargo-clippy", deny(clippy::missing_inline_in_public_items))]
62#![doc(html_root_url = "https://docs.rs/typenum/1.14.0")]
63
64use core::cmp::Ordering;
69
70#[cfg(feature = "force_unix_path_separator")]
71mod generated {
72 include!(concat!(env!("OUT_DIR"), "/op.rs"));
73 include!(concat!(env!("OUT_DIR"), "/consts.rs"));
74}
75
76#[cfg(not(feature = "force_unix_path_separator"))]
77mod generated {
78 include!(env!("TYPENUM_BUILD_OP"));
79 include!(env!("TYPENUM_BUILD_CONSTS"));
80}
81
82pub mod bit;
83pub mod int;
84pub mod marker_traits;
85pub mod operator_aliases;
86pub mod private;
87pub mod type_operators;
88pub mod uint;
89
90pub mod array;
91
92pub use crate::{
93 array::{ATerm, TArr},
94 consts::*,
95 generated::consts,
96 int::{NInt, PInt},
97 marker_traits::*,
98 operator_aliases::*,
99 type_operators::*,
100 uint::{UInt, UTerm},
101};
102
103#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)]
106pub struct Greater;
107
108#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)]
111pub struct Less;
112
113#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Debug, Default)]
116pub struct Equal;
117
118impl Ord for Greater {
120 #[inline]
121 fn to_ordering() -> Ordering {
122 Ordering::Greater
123 }
124}
125
126impl Ord for Less {
128 #[inline]
129 fn to_ordering() -> Ordering {
130 Ordering::Less
131 }
132}
133
134impl Ord for Equal {
136 #[inline]
137 fn to_ordering() -> Ordering {
138 Ordering::Equal
139 }
140}
141
142#[macro_export]
144macro_rules! assert_type_eq {
145 ($a:ty, $b:ty) => {
146 const _: core::marker::PhantomData<<$a as $crate::Same<$b>>::Output> =
147 core::marker::PhantomData;
148 };
149}
150
151#[macro_export]
153macro_rules! assert_type {
154 ($a:ty) => {
155 const _: core::marker::PhantomData<<$a as $crate::Same<True>>::Output> =
156 core::marker::PhantomData;
157 };
158}
159
160mod sealed {
161 use crate::{
162 ATerm, Bit, Equal, Greater, Less, NInt, NonZero, PInt, TArr, UInt, UTerm, Unsigned, B0, B1,
163 Z0,
164 };
165
166 pub trait Sealed {}
167
168 impl Sealed for B0 {}
169 impl Sealed for B1 {}
170
171 impl Sealed for UTerm {}
172 impl<U: Unsigned, B: Bit> Sealed for UInt<U, B> {}
173
174 impl Sealed for Z0 {}
175 impl<U: Unsigned + NonZero> Sealed for PInt<U> {}
176 impl<U: Unsigned + NonZero> Sealed for NInt<U> {}
177
178 impl Sealed for Less {}
179 impl Sealed for Equal {}
180 impl Sealed for Greater {}
181
182 impl Sealed for ATerm {}
183 impl<V, A> Sealed for TArr<V, A> {}
184}