fix: make text macro example pass doctest

This commit is contained in:
Richard Custodio 2024-03-18 20:24:42 -03:00
parent d71e78d138
commit 72ed8bcc8d
No known key found for this signature in database
GPG key ID: 95F51F46E2C6E8D7

View file

@ -62,15 +62,32 @@ macro_rules! row {
///
/// # Examples
///
/// ```
/// fn view(&self) -> Element<Message> {
/// let simple = text!("Hello, world!");
/// ```no_run
/// # mod iced {
/// # pub struct Element<Message>(pub std::marker::PhantomData<Message>);
/// # pub mod widget {
/// # macro_rules! text {
/// # ($($arg:tt)*) => {unimplemented!()}
/// # }
/// # pub(crate) use text;
/// # }
/// # }
/// # struct Example;
/// # enum Message {}
/// use iced::Element;
/// use iced::widget::text;
///
/// let keyword = text!("Hello, {}", "world!");
/// impl Example {
/// fn view(&self) -> Element<Message> {
/// let simple = text!("Hello, world!");
///
/// let planet = "Earth";
/// let local_variable = text!("Hello, {planet}!");
/// // ...
/// let keyword = text!("Hello, {}", "world!");
///
/// let planet = "Earth";
/// let local_variable = text!("Hello, {planet}!");
/// // ...
/// # iced::Element(std::marker::PhantomData)
/// }
/// }
/// ```
#[macro_export]