From a62d6a400e0f23f75ae1bc09646ac9c4002f7221 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:41:27 +0400 Subject: [PATCH] feat(codegen): support NonZero numbers (#1012) --- codegen/src/types/type_path.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/codegen/src/types/type_path.rs b/codegen/src/types/type_path.rs index 18d85aea78..def2a6e374 100644 --- a/codegen/src/types/type_path.rs +++ b/codegen/src/types/type_path.rs @@ -146,6 +146,18 @@ impl TypePathType { "BTreeSet" => parse_quote!(::std::collections::BTreeSet), "Range" => parse_quote!(::core::ops::Range), "RangeInclusive" => parse_quote!(::core::ops::RangeInclusive), + "NonZeroI8" => parse_quote!(::core::num::NonZeroI8), + "NonZeroU8" => parse_quote!(::core::num::NonZeroU8), + "NonZeroI16" => parse_quote!(::core::num::NonZeroI16), + "NonZeroU16" => parse_quote!(::core::num::NonZeroU16), + "NonZeroI32" => parse_quote!(::core::num::NonZeroI32), + "NonZeroU32" => parse_quote!(::core::num::NonZeroU32), + "NonZeroI64" => parse_quote!(::core::num::NonZeroI64), + "NonZeroU64" => parse_quote!(::core::num::NonZeroU64), + "NonZeroI128" => parse_quote!(::core::num::NonZeroI128), + "NonZeroU128" => parse_quote!(::core::num::NonZeroU128), + "NonZeroIsize" => parse_quote!(::core::num::NonZeroIsize), + "NonZeroUsize" => parse_quote!(::core::num::NonZeroUsize), ident => panic!("Unknown prelude type '{ident}'"), } }