I'm assuming usize isn't guaranteed to be at least 32 bits? Is Rust supported on any 16-bit platforms? The reason I ask is I am writing a no_std library and don't want to restrict the platform any more than necessary, but my library definitely requires (in a naive implementation) some arrays larger than a 16-bit index will support. What's the proper way of handling something like that (or at the very least indicating to a user of the library that it requires at least 32-bit indexing).
Also, if my library has some value which should be configurable by the library user, but in my library it must be a compile time constant, then what is the best way to expose that fact to users of my library?
Correct. There are AFAIK no existing ports of rust to 16 bit platforms but it can theoretically be only 16 bit. The suggested way to convert u32 to usize is to use try_from().unwrap(). On platforms with >=32 bit address space the spurious check should be optimized out. On (theoretical) 16 bit platforms it would just fail.
To be honest this is one of my rust pet peeves. I wish there was a way to mark a crate as 'needs 32-bit' and have usize::from(u32) just work.