@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.
Ok I'm tired... In #ratatui How Am I supposed to return a Span<'> from a function ? Where does this lifetime comes from? #rustlang
everything is owned in my function:
fn display_battery_level(bat: f32) -> Span<'> {
let bat_s = bat.to_string();
match bat {
_ if bat > 50.0 => bat_s.green(),
_ if bat > 25.0 => bat_s.yellow(),
_ => bat_s.red(),
}
}

Alex Akselrod
boosted
Tachyonfx brings web-level animations to the command line..
Then Ratzilla puts it back in browsers where it belongs 🤷♂️
Witness this beautiful chaos: https://junkdog.github.io/exabind 🌀
🦀 Powered by Rust & @ratatui_rs ecosystem
⭐ GitHub: https://github.com/junkdog/exabind
#rustlang #ratatui #tui #animations #commandline #webgl2 #terminal