Skip to main content

println

Function println 

Source
pub fn println(msg: impl Into<String>) -> Cmd
Expand description

Print a line above the program’s TUI output.

This output is unmanaged by the program and will persist across renders. Unlike std::println!, the message is printed on its own line (similar to log::info!).

Note: If the alternate screen is active, no output will be printed. This is because alternate screen mode uses a separate buffer that doesn’t support this kind of unmanaged output.

§Example

use bubbletea::{Model, Message, Cmd, println};

impl Model for MyModel {
    fn update(&mut self, msg: Message) -> Option<Cmd> {
        if msg.is::<DownloadComplete>() {
            return Some(println("Download finished!"));
        }
        None
    }
}