I am iterating over a bunch of null-terminated C strings of type [c_char; 256] and have to compare them against a handful of hardcoded values and ended up with the following monstrosity:
available_instance_extensions.iter().for_each(|extension| {
if unsafe { CStr::from_ptr(extension.extension_name.as_ptr()) }
.to_str()
.unwrap()
== "VK_KHR_get_physical_device_properties2"
{
log::info!("Got it!");
}
});
Is there any idiomatic and sane approach to do so?