diff options
author | 2019-11-22 22:14:04 +0100 | |
---|---|---|
committer | 2019-11-22 22:14:04 +0100 | |
commit | fa227255b02adbbfa99801a7baaa4d6d387f7302 (patch) | |
tree | 1b9b4c97a6b6a054ff73cd69ac9b1493f50392c3 /web/src/widget.rs | |
parent | 048909b45dfecef73bfacf3b5aa67462470ccca2 (diff) | |
download | iced-fa227255b02adbbfa99801a7baaa4d6d387f7302.tar.gz iced-fa227255b02adbbfa99801a7baaa4d6d387f7302.tar.bz2 iced-fa227255b02adbbfa99801a7baaa4d6d387f7302.zip |
Write docs for `iced_web`
Diffstat (limited to 'web/src/widget.rs')
-rw-r--r-- | web/src/widget.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/web/src/widget.rs b/web/src/widget.rs index 88b2efc9..30ac8eeb 100644 --- a/web/src/widget.rs +++ b/web/src/widget.rs @@ -1,15 +1,31 @@ +//! Use the built-in widgets or create your own. +//! +//! # Custom widgets +//! If you want to implement a custom widget, you simply need to implement the +//! [`Widget`] trait. You can use the API of the built-in widgets as a guide or +//! source of inspiration. +//! +//! # Re-exports +//! For convenience, the contents of this module are available at the root +//! module. Therefore, you can directly type: +//! +//! ``` +//! use iced_web::{button, Button, Widget}; +//! ``` +//! +//! [`Widget`]: trait.Widget.html use crate::Bus; use dodrio::bumpalo; pub mod button; pub mod slider; -pub mod text; mod checkbox; mod column; mod image; mod radio; mod row; +mod text; #[doc(no_inline)] pub use button::Button; @@ -26,7 +42,16 @@ pub use image::Image; pub use radio::Radio; pub use row::Row; +/// A component that displays information and allows interaction. +/// +/// If you want to build your own widgets, you will need to implement this +/// trait. +/// +/// [`Widget`]: trait.Widget.html pub trait Widget<Message> { + /// Produces a VDOM node for the [`Widget`]. + /// + /// [`Widget`]: trait.Widget.html fn node<'b>( &self, bump: &'b bumpalo::Bump, |