#![no_std]
#![warn(missing_docs)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::style))]
use core::{mem, marker};
#[repr(transparent)]
pub struct Type<T>(marker::PhantomData<T>);
impl<T> Type<T> {
#[inline(always)]
pub const fn size() -> usize {
mem::size_of::<T>()
}
#[inline(always)]
pub const fn align() -> usize {
mem::align_of::<T>()
}
#[inline(always)]
pub const fn is_zst() -> bool {
Self::size() == 0
}
#[inline(always)]
pub const fn needs_drop() -> bool {
mem::needs_drop::<T>()
}
}
#[repr(transparent)]
pub struct Assert<T>(marker::PhantomData<T>);
impl<T> Assert<T> {
pub const NO_NEED_DROP: () = assert!(!Type::<T>::needs_drop());
pub const IS_NOT_ZST: () = assert!(!Type::<T>::is_zst());
pub const IS_ZST: () = assert!(Type::<T>::is_zst());
}
#[repr(transparent)]
pub struct Assert2<L, R>(marker::PhantomData<(L, R)>);
impl<L, R> Assert2<L, R> {
pub const IS_SAME_SIZE: () = assert!(Type::<L>::size() == Type::<R>::size());
pub const IS_SAME_ALIGN: () = assert!(Type::<L>::align() == Type::<R>::align());
pub const IS_LEFT_SIZE_GREATER_OR_EQUAL: () = assert!(Type::<L>::size() >= Type::<R>::size());
pub const IS_LEFT_SIZE_LESS: () = assert!(Type::<L>::size() < Type::<R>::size());
pub const IS_LEFT_ALIGN_GREATER_OR_EQUAL: () = assert!(Type::<L>::align() >= Type::<R>::align());
pub const IS_LEFT_ALIGN_LESS: () = assert!(Type::<L>::align() < Type::<R>::align());
}