#![doc = include_str!("../README.md")]
#![cfg_attr(feature = "std", no_std)]
#![cfg_attr(feature = "unchecked_math", feature(unchecked_math))]
#![cfg_attr(feature = "const_inherent_unchecked_arith", feature(const_inherent_unchecked_arith))]
#[cfg(feature = "const_inherent_unchecked_arith")]
use const_fn::const_fn;
#[cfg(all(doc, feature = "doc"))]
use include_display_mode_tex::include_display_mode_tex;
pub struct ZBI<T>(pub T);
impl ZBI<usize> {
#[cfg_attr(all(doc, feature = "doc"), doc = include_display_mode_tex!("./tex/to_len.tex"))]
pub const fn to_len(&self) -> Option<usize> {
self.0.checked_add(1)
}
#[cfg_attr(all(doc, feature = "doc"), doc = include_display_mode_tex!("./tex/to_len.tex"))]
#[cfg(feature = "unchecked_math")]
#[cfg_attr(feature = "const_inherent_unchecked_arith", const_fn)]
pub unsafe fn to_len_unchecked(&self) -> usize {
self.0.unchecked_add(1)
}
}
pub trait AsZBI: Sized {
fn as_zbi(self) -> ZBI<Self>;
}
impl AsZBI for usize {
fn as_zbi(self) -> ZBI<Self> {
ZBI(self)
}
}