I'm trying to break my code up into smaller functions. Here's one such function where I'm initializing a struct, but I'm using local variables as part of the process to build my resulting value:
fn build_app_info<'a>() -> vk::ApplicationInfoBuilder<'a> {
let application_name = CString::new("vkFire").unwrap();
let engine_name = CString::new("UnknownGameEngine").unwrap();
vk::ApplicationInfo::builder()
.application_name(&application_name)
.application_version(vk::make_version(0, 0, 1))
.engine_name(&engine_name)
.engine_version(vk::make_version(0, 42, 0))
.api_version(vk::make_version(1, 0, 106))
}
I end up getting an error because I can't borrow my local application_name
or engine_name
variables to build my result variable that I intend on returning. That does make sense in a degree, but how else should I go about this? I could pass those variables in as inputs to my function, but I'd prefer to avoid that at this point in time. I intentionally want that logic hard-coded.
Is there are way that I can declare lifetime specifiers on local variables?