diff options
author | 2024-09-19 06:59:05 +0200 | |
---|---|---|
committer | 2024-09-19 06:59:05 +0200 | |
commit | ddbb8445bf60de7169727721a5cb57048ded3d82 (patch) | |
tree | 1f2b90d5f0e010be72e4bbd20da6c22e1478b573 /widget/src/keyed/column.rs | |
parent | 1f8dc1f3dda25c699b94c653d5d569f4142e9b83 (diff) | |
parent | 31c42c1d02d6a76dedaa780e6832a23765c8aef2 (diff) | |
download | iced-ddbb8445bf60de7169727721a5cb57048ded3d82.tar.gz iced-ddbb8445bf60de7169727721a5cb57048ded3d82.tar.bz2 iced-ddbb8445bf60de7169727721a5cb57048ded3d82.zip |
Merge pull request #2587 from iced-rs/improve-api-reference
Add widget examples to API reference and update `README`
Diffstat (limited to 'widget/src/keyed/column.rs')
-rw-r--r-- | widget/src/keyed/column.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/widget/src/keyed/column.rs b/widget/src/keyed/column.rs index 2c56c605..5852ede1 100644 --- a/widget/src/keyed/column.rs +++ b/widget/src/keyed/column.rs @@ -1,4 +1,4 @@ -//! Distribute content vertically. +//! Keyed columns distribute content vertically while keeping continuity. use crate::core::event::{self, Event}; use crate::core::layout; use crate::core::mouse; @@ -11,7 +11,25 @@ use crate::core::{ Shell, Size, Vector, Widget, }; -/// A container that distributes its contents vertically. +/// A container that distributes its contents vertically while keeping continuity. +/// +/// # Example +/// ```no_run +/// # mod iced { pub mod widget { pub use iced_widget::*; } } +/// # pub type State = (); +/// # pub type Element<'a, Message> = iced_widget::core::Element<'a, Message, iced_widget::Theme, iced_widget::Renderer>; +/// use iced::widget::{keyed_column, text}; +/// +/// enum Message { +/// // ... +/// } +/// +/// fn view(state: &State) -> Element<'_, Message> { +/// keyed_column((0..=100).map(|i| { +/// (i, text!("Item {i}").into()) +/// })).into() +/// } +/// ``` #[allow(missing_debug_implementations)] pub struct Column< 'a, |