iced::widget

Macro text

source
macro_rules! text {
    ($($arg:tt)*) => { ... };
}
Expand description

Creates a new Text widget with the provided content.

This macro uses the same syntax as format!, but creates a new Text widget instead.

See the formatting documentation in std::fmt for details of the macro argument syntax.

ยงExamples

use iced::widget::text;

enum Message {
    // ...
}

fn view(_state: &State) -> Element<Message> {
    let simple = text!("Hello, world!");

    let keyword = text!("Hello, {}", "world!");

    let planet = "Earth";
    let local_variable = text!("Hello, {planet}!");
    // ...
}