I am getting a weird error involving the "field.text().await.unwrap_or("".to_string())" for something line giving me this error:
emporary value dropped while borrowed
creates a temporary value which is freed while still in userustcClick for full compiler diagnostic
something.rs(55, 105): temporary value is freed at the end of this statement
something.rs(55, 31): argument requires that borrow lasts for 'static
pub async fn add_something(mut fields: Multipart) -> Result<String, (StatusCode, String)>{
let mut works = "".to_string();
let mut something = "".to_string();
while let Some(field) = fields.next_field().await.map_err(|err| (StatusCode::BAD_REQUEST, err.to_string())).unwrap() {
match &name[..] {
"works" => works = field.text().await.unwrap_or("".to_string()),
"something" => something = field.text().await.unwrap_or("".to_string()).split(',').collect::<Vec<_>>(),
_ => print!("nothing")
}
}
Also asked this on r/rust, but there neckbeard mods removed it in .005 seconds. Lovely people lol