billyb2 / game

GNU Affero General Public License v3.0
2 stars 0 forks source link

Replace `as` with `try_from` #61

Open billyb2 opened 3 years ago

billyb2 commented 3 years ago

as has the wonderful side effect of only taking lower bits of a conversion when type casting, which means that if the value is too large, it can have some very nasty side effects. TryFrom, meanwhile, does what I want it to (return a Result type that can be dealt with properly, probably by crashing the program for now lol.)