Skip to content

Commit

Permalink
docs: improve text macro documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
derezzedex committed Mar 18, 2024
1 parent bf9bbf4 commit db7d868
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions widget/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {

Check failure on line 66 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

`self` parameter is only allowed in associated functions

Check failure on line 66 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

cannot find type `Element` in this scope

Check failure on line 66 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

cannot find type `Message` in this scope

Check failure on line 66 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

`self` parameter is only allowed in associated functions

Check failure on line 66 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

cannot find type `Element` in this scope

Check failure on line 66 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

cannot find type `Message` in this scope
/// let empty = text!();

Check failure on line 67 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

cannot find macro `text` in this scope

Check failure on line 67 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

cannot find macro `text` in this scope
/// let simple = text!("Hello, world!");

Check failure on line 68 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

cannot find macro `text` in this scope

Check failure on line 68 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

cannot find macro `text` in this scope
/// let keyword = text!("Hello, {}", "world!");

Check failure on line 69 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

cannot find macro `text` in this scope

Check failure on line 69 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

cannot find macro `text` in this scope
/// let planet = "Earth";
/// let complex = text!("Hello, {planet}!");

Check failure on line 71 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, stable)

cannot find macro `text` in this scope

Check failure on line 71 in widget/src/helpers.rs

View workflow job for this annotation

GitHub Actions / all (ubuntu-latest, beta)

cannot find macro `text` in this scope
/// }
/// ```
#[macro_export]
macro_rules! text {
() => (
Expand Down

0 comments on commit db7d868

Please sign in to comment.