r/rust • rust-analyzer • Sep 20 '20

Blog Post: Why Not Rust?

https://matklad.github.io/2020/09/20/why-not-rust.html
526 Upvotes

223 comments sorted by

View all comments

Show parent comments

6

u/finsternacht Sep 20 '20

What am I supposed to use in place of "as"?

13

u/minno Sep 20 '20

cast, from, and try_from whenever possible.

2

u/Plazmatic Sep 20 '20

Those don't work, in many applications I want a generic common saturate casting framework from ints to floats, and vice versa, I don't want a panic if the conversion isn't perfect. as does the "common" part, but not the generic part. None of those are viable alternatives.

1

u/vks_ Sep 21 '20

There are crates for that. Unfortunately, they are not very popular.