How to enter integers safely?

There used to be fn std::num::cast , which would execute between integer types and return Option (return None if the cast was invalid). Where did this functionality go?

+6
source share
1 answer

Similarly to the previous question, this functionality has moved to the num box. More precisely, It in num :: traits :: cast .

+7
source

Source: https://habr.com/ru/post/986584/


All Articles