diff options
author | 2024-09-19 06:10:44 +0200 | |
---|---|---|
committer | 2024-09-19 06:10:44 +0200 | |
commit | 6ad7c7d3080816d37b17f1f6f5af5d8761983fdc (patch) | |
tree | bfaa5375c6908c4121db067f6d33cefa4876d8b8 /widget/src/text.rs | |
parent | 9773631354aa1af354647fbdbdd8111da2816afb (diff) | |
download | iced-6ad7c7d3080816d37b17f1f6f5af5d8761983fdc.tar.gz iced-6ad7c7d3080816d37b17f1f6f5af5d8761983fdc.tar.bz2 iced-6ad7c7d3080816d37b17f1f6f5af5d8761983fdc.zip |
Show `text` doc examples in multiple places
Diffstat (limited to '')
-rw-r--r-- | widget/src/text.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/widget/src/text.rs b/widget/src/text.rs index 9bf7fce4..c2243434 100644 --- a/widget/src/text.rs +++ b/widget/src/text.rs @@ -5,6 +5,26 @@ pub use crate::core::text::{Fragment, Highlighter, IntoFragment, Span}; pub use crate::core::widget::text::*; pub use rich::Rich; -/// A paragraph. +/// A bunch of text. +/// +/// # Example +/// ```no_run +/// # mod iced { pub mod widget { pub use iced_widget::*; } pub use iced_widget::Renderer; pub use iced_widget::core::*; } +/// # pub type State = (); +/// # pub type Element<'a, Message> = iced_widget::core::Element<'a, Message, iced_widget::Theme, iced_widget::Renderer>; +/// use iced::widget::text; +/// use iced::color; +/// +/// enum Message { +/// // ... +/// } +/// +/// fn view(state: &State) -> Element<'_, Message> { +/// text("Hello, this is iced!") +/// .size(20) +/// .color(color!(0x0000ff)) +/// .into() +/// } +/// ``` pub type Text<'a, Theme = crate::Theme, Renderer = crate::Renderer> = crate::core::widget::Text<'a, Theme, Renderer>; |