H2CO3's answer is the best one for your actual use case.
But if you ever need integer square root in the future, here's a previous thread about it: Integer square root algorithm - #5 by scottmcm
IIRC the easiest is f64::from(x).sqrt() as u32
, because f64
has enough mantissa precision for this. But rounding modes are complicated, so you'd want to double-check that. (There's only 4 billion, so you can just check that isqrt(x).pow(2) <= x
for all of them without trouble.)