Make bindings resilient to OOM errors
This PR proposes a relatively simple but maybe controversial change.
In the functions that return a Vec, instead of using Vec::with_capacity and similar, we use Vec::new() followed with Vec::try_reserve. If try_reserve fails, we return VK_ERROR_OUT_OF_HOST_MEMORY.
Note that there's no shorter way on stable Rust to do this. Notably, try_with_capacity is unstable.
If I'm not mistaken, the bindings now never panic in case of OOM.
I personally don't have a need for this change, but I thought that this was a neat thing to add.
If we end up doing this, is there a lint that enables us to catch accidental/new remaining calls to Vec::with_capacity() and friends, that may result in panicking allocations?
Alternatively we could list such functions in disallowed-methods in clippy.toml via clippy::disallowed_methods.
I personally don't have a need for this change, but I thought that this was a neat thing to add.
Might be neat, but if we do this we're better complete about it :)