We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all uX and iX types implements checked_add_signed and it would be handy to have a trait as marker for such types:
pub trait CheckedAddSigned where Self: Sized, { type RHS: TryFrom<i32>; fn checked_add_signed(self, rhs: Self::RHS) -> Option<Self>; } macro_rules! impl_checked_add_signed { ($t:ident, $rhs:ident) => { impl CheckedAddSigned for $t { type RHS = $rhs; fn checked_add_signed(self, rhs: Self::RHS) -> Option<Self> { Self::checked_add_signed(self, rhs) } } }; } impl_checked_add_signed!(u8, i8); impl_checked_add_signed!(u16, i16); impl_checked_add_signed!(u32, i32); impl_checked_add_signed!(u64, i64); impl_checked_add_signed!(usize, isize);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
all uX and iX types implements checked_add_signed and it would be handy to have a trait as marker for such types:
The text was updated successfully, but these errors were encountered: