diff options
author | 2024-03-18 17:46:22 -0300 | |
---|---|---|
committer | 2024-03-18 17:46:22 -0300 | |
commit | db7d8680ce198439921c8856b2d6d0ccfa4d66ff (patch) | |
tree | 700350dfb3844a7c4a93e7678fcae67f47bf3877 /widget/src/helpers.rs | |
parent | bf9bbf4a3edf22f21c79901999cc104cb29fccce (diff) | |
download | iced-db7d8680ce198439921c8856b2d6d0ccfa4d66ff.tar.gz iced-db7d8680ce198439921c8856b2d6d0ccfa4d66ff.tar.bz2 iced-db7d8680ce198439921c8856b2d6d0ccfa4d66ff.zip |
docs: improve `text` macro documentation
Diffstat (limited to 'widget/src/helpers.rs')
-rw-r--r-- | widget/src/helpers.rs | 17 |
1 files changed, 17 insertions, 0 deletions
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<Message> { +/// 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 { () => ( |