@corpsmoderne You can't. It borrows from a value created inside the function. You can only return temporary references to values that existed before the function has been called.
Discussion
fn display_battery_level<'a>(bat: f32, bat_s: &'a str) -> Span<'a> {
match bat {
_ if bat > 50.0 => bat_s.green(),
_ if bat > 25.0 => bat_s.yellow(),
_ => bat_s.red(),
}
}
A space for Bonfire maintainers and contributors to communicate