From db7d8680ce198439921c8856b2d6d0ccfa4d66ff Mon Sep 17 00:00:00 2001 From: Richard Custodio Date: Mon, 18 Mar 2024 17:46:22 -0300 Subject: docs: improve `text` macro documentation --- widget/src/helpers.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 1b57cd21..966d23cc 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -54,6 +54,23 @@ macro_rules! row { /// Creates a new [`Text`] widget with the provided content. /// /// [`Text`]: core::widget::Text +/// +/// This macro uses the same syntax as [`format!`], but creates a new [`Text`] widget instead. +/// +/// See [the formatting documentation in `std::fmt`](std::fmt) +/// for details of the macro argument syntax. +/// +/// # Examples +/// +/// ``` +/// fn view(&self) -> Element { +/// let empty = text!(); +/// let simple = text!("Hello, world!"); +/// let keyword = text!("Hello, {}", "world!"); +/// let planet = "Earth"; +/// let complex = text!("Hello, {planet}!"); +/// } +/// ``` #[macro_export] macro_rules! text { () => ( -- cgit