Extends the traits from num_traits::identities to use an associated constant.
Examples
# extern crate const_identities;
use ConstZero;
;
assert_eq!;
Extends the traits from num_traits::identities to use an associated constant.
#![feature(const_fn)]
# extern crate const_identities;
use const_identities::ConstZero;
pub struct Newtype<T>(pub T);
impl<T: ConstZero> Newtype<T> {
pub const fn zero() -> Self {
Newtype(T::ZERO)
}
}
assert_eq!(Newtype::<i32>::zero().0, 0);