diff options
author | 2024-09-19 05:05:09 +0200 | |
---|---|---|
committer | 2024-09-19 05:05:09 +0200 | |
commit | 1595e78b1ad58e09dfa049546f6627dd5f80075b (patch) | |
tree | 1e700948ff26364ae01f2b4f712890b7bed39a06 /widget/src/helpers.rs | |
parent | c646ff5f1feb1112f9e34d75e40246e4fc1c74e6 (diff) | |
download | iced-1595e78b1ad58e09dfa049546f6627dd5f80075b.tar.gz iced-1595e78b1ad58e09dfa049546f6627dd5f80075b.tar.bz2 iced-1595e78b1ad58e09dfa049546f6627dd5f80075b.zip |
Show `qr_code` doc example in multiple places
Diffstat (limited to 'widget/src/helpers.rs')
-rw-r--r-- | widget/src/helpers.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 53286e0a..4be5045a 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -1290,8 +1290,31 @@ where /// Creates a new [`QRCode`] widget from the given [`Data`]. /// +/// QR codes display information in a type of two-dimensional matrix barcode. +/// /// [`QRCode`]: crate::QRCode /// [`Data`]: crate::qr_code::Data +/// +/// # Example +/// ```no_run +/// # mod iced { pub mod widget { pub use iced_widget::*; } pub use iced_widget::Renderer; pub use iced_widget::core::*; } +/// # pub type Element<'a, Message> = iced_widget::core::Element<'a, Message, iced_widget::Theme, iced_widget::Renderer>; +/// # +/// use iced::widget::qr_code; +/// +/// struct State { +/// data: qr_code::Data, +/// } +/// +/// #[derive(Debug, Clone)] +/// enum Message { +/// // ... +/// } +/// +/// fn view(state: &State) -> Element<'_, Message> { +/// qr_code(&state.data).into() +/// } +/// ``` #[cfg(feature = "qr_code")] pub fn qr_code<'a, Theme>( data: &'a crate::qr_code::Data, |