// Copyright 2025 Gabriel Bjørnager Jensen.

mod test;

use crate::IntLeast16;

use core::convert::Infallible;

/// Denotes a signed integer that is at least as wide as [`i32`].
///
/// # Safety
///
/// Only primitive, signed, integral types that fit the size requirement may implement this type.
pub trait IntLeast32
where
	Self:
		crate::seal::IntLeast32
		+ IntLeast16
		+ From<i32>
		+ From<u16>
		+ TryFrom<i32, Error = Infallible>
		+ TryFrom<u16, Error = Infallible>,
{}

macro_rules! impl_int_least32 {
	{ $($Ty:ty),*$(,)? } => {$(
		impl ::multitype::seal::IntLeast32 for $Ty {}

		impl ::multitype::IntLeast32 for $Ty {}
	)*};
}

impl_int_least32! {
	i32,
	i64,
	i128,
}
