Write missing documentation in iced_widget

This commit is contained in:
Héctor Ramón Jiménez 2023-05-11 15:40:57 +02:00
parent de638f44a5
commit b60194844a
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 15 additions and 1 deletions

View file

@ -26,6 +26,7 @@ use std::cell::RefCell;
use std::hash::{Hash, Hasher as H};
use std::rc::Rc;
/// A widget that only rebuilds its contents when necessary.
#[allow(missing_debug_implementations)]
pub struct Lazy<'a, Message, Renderer, Dependency, View> {
dependency: Dependency,
@ -41,6 +42,8 @@ where
Dependency: Hash + 'a,
View: Into<Element<'static, Message, Renderer>>,
{
/// Creates a new [`Lazy`] widget with the given data `Dependency` and a
/// closure that can turn this data into a widget tree.
pub fn new(
dependency: Dependency,
view: impl Fn(&Dependency) -> View + 'a,

View file

@ -4,6 +4,8 @@ use crate::lazy::{Lazy, Responsive};
use std::hash::Hash;
/// Creates a new [`Lazy`] widget with the given data `Dependency` and a
/// closure that can turn this data into a widget tree.
pub fn lazy<'a, Message, Renderer, Dependency, View>(
dependency: Dependency,
view: impl Fn(&Dependency) -> View + 'a,
@ -29,6 +31,12 @@ where
component::view(component)
}
/// Creates a new [`Responsive`] widget with a closure that produces its
/// contents.
///
/// The `view` closure will be provided with the current [`Size`] of
/// the [`Responsive`] widget and, therefore, can be used to build the
/// contents of the widget in a responsive way.
pub fn responsive<'a, Message, Renderer>(
f: impl Fn(Size) -> Element<'a, Message, Renderer> + 'a,
) -> Responsive<'a, Message, Renderer>

View file

@ -4,7 +4,7 @@
)]
#![deny(
missing_debug_implementations,
//missing_docs,
missing_docs,
unused_results,
clippy::extra_unused_lifetimes,
clippy::from_over_into,

View file

@ -1 +1,2 @@
//! Display interactive elements on top of other widgets.
pub mod menu;

View file

@ -1,4 +1,6 @@
//! Draw and interact with text.
pub use crate::core::widget::text::*;
/// A paragraph.
pub type Text<'a, Renderer = crate::Renderer> =
crate::core::widget::Text<'a, Renderer>;