Closed greyblake closed 11 months ago
Hi, thank you for the crate and your work, which powers a lot of library developers :heart:
Is there any chance to implement ToTokens for NonZero integers? (::core::num::NonZeroU8, etc...)
ToTokens
::core::num::NonZeroU8
If you're fine with the idea, I could open a PR. It may not be a plane decision, how NonZero integer should be converted into tokens
::core::num::NonZeroU8::new(123).unwrap()
unsafe { ::core::num::NonZeroU8::new_unchecked(123) }
In nutype I'd like to add support for NonZero integers. With my current implementation the effort would be relatively low if NonZero integers implemented ToTokens?
I think I would prefer not to build this into this crate. Hopefully there's a different way you could handle these in nutype.
@dtolnay All cool. Thanks for the quick reply.
Hi, thank you for the crate and your work, which powers a lot of library developers :heart:
Request
Is there any chance to implement
ToTokens
for NonZero integers? (::core::num::NonZeroU8
, etc...)If you're fine with the idea, I could open a PR. It may not be a plane decision, how NonZero integer should be converted into tokens
Variant A (with a runtime penalty):
Variant B (with unsafe):
Context
In nutype I'd like to add support for NonZero integers. With my current implementation the effort would be relatively low if NonZero integers implemented
ToTokens
?