Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to safely cast integers?

Tags:

rust

There used to be a fn std::num::cast that would cast between integer types and return an Option (returning None if the cast was invalid). Where did that functionality go?

like image 275
bfops Avatar asked May 05 '15 15:05

bfops


1 Answers

Similarily to previous question, that functionality moved to num crate. More precisely, It's in num::traits::cast.

like image 179
Daniel Fath Avatar answered Oct 10 '22 06:10

Daniel Fath