macro_rules! span {
($($arg:tt)*) => { ... };
}Expand description
Creates a new Span of text with the provided content.
A Span is a fragment of some Rich text.
This macro uses the same syntax as format!, but creates a new Span widget instead.
See the formatting documentation in std::fmt
for details of the macro argument syntax.
§Example
ⓘ
use iced::font;
use iced_selection::{rich_text, span};
use iced::{color, never, Font};
#[derive(Debug, Clone)]
enum Message {
// ...
}
fn view(state: &State) -> Element<'_, Message> {
rich_text![
span!("I am {}!", red).color(color!(0xff0000)),
" ",
span!("And I am bold!").font(Font { weight: font::Weight::Bold, ..Font::default() }),
]
.on_link_click(never)
.size(20)
.into()
}