docs: improve text macro documentation
This commit is contained in:
parent
bf9bbf4a3e
commit
db7d8680ce
1 changed files with 17 additions and 0 deletions
|
|
@ -54,6 +54,23 @@ macro_rules! row {
|
||||||
/// Creates a new [`Text`] widget with the provided content.
|
/// Creates a new [`Text`] widget with the provided content.
|
||||||
///
|
///
|
||||||
/// [`Text`]: core::widget::Text
|
/// [`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_export]
|
||||||
macro_rules! text {
|
macro_rules! text {
|
||||||
() => (
|
() => (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue