I'm tired of so many usize::try_from(x).expect("I know it will not fail"); in my code, so I wrote this little crate as my solution.
First - if a code can't possibly work with smaller than X bit architectures, it will enable infalliable usize::cast_from and isize::cast_from conversions (among all existing from versions).
Second - when the code is relying on knowledge that certain value will fit certain conversion, it enables u32::checked_from(x); that will just panic on failure, to avoid both the .expect, and problems with using as.
And that's kind of it. Fairly small and unspectacular. If I missed a crate that does this already, please let me know. Any feedback welcome (especially naming).
BTW. I was wondering if cast_from shouldn't just be from, given that it's a super-set of From. This way one could just use convi::From and use usize::from(...) etc. . The shadowing can be a bit confusing sometimes, but a lot crates use Result and Error and it people learned to live with it.