Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature doc to Component trait #2289

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions widget/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use std::rc::Rc;

/// A widget that only rebuilds its contents when necessary.
#[cfg(feature = "lazy")]
#[allow(missing_debug_implementations)]
pub struct Lazy<'a, Message, Theme, Renderer, Dependency, View> {
dependency: Dependency,
Expand Down Expand Up @@ -267,7 +268,7 @@
layout: Layout<'_>,
renderer: &Renderer,
translation: Vector,
) -> Option<overlay::Element<'_, Message, Theme, Renderer>> {

Check warning on line 271 in widget/src/lazy.rs

View workflow job for this annotation

GitHub Actions / all

elided lifetime has a name
let overlay = Overlay(Some(
InnerBuilder {
cell: self.element.borrow().as_ref().unwrap().clone(),
Expand Down
1 change: 1 addition & 0 deletions widget/src/lazy/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use std::rc::Rc;
///
/// Additionally, a [`Component`] is capable of producing a `Message` to notify
/// the parent application of any relevant interactions.
#[cfg(feature = "lazy")]
pub trait Component<Message, Theme = crate::Theme, Renderer = crate::Renderer> {
/// The internal state of this [`Component`].
type State: Default;
Expand Down
5 changes: 3 additions & 2 deletions widget/src/lazy/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::core::{self, Element, Size};
use crate::lazy::component::{self, Component};
use crate::lazy::{Lazy, Responsive};
use crate::lazy::component;

use std::hash::Hash;

pub use crate::lazy::{Component, Lazy, Responsive};

/// Creates a new [`Lazy`] widget with the given data `Dependency` and a
/// closure that can turn this data into a widget tree.
#[cfg(feature = "lazy")]
Expand Down
1 change: 1 addition & 0 deletions widget/src/lazy/responsive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::ops::Deref;
///
/// A [`Responsive`] widget will always try to fill all the available space of
/// its parent.
#[cfg(feature = "lazy")]
#[allow(missing_debug_implementations)]
pub struct Responsive<
'a,
Expand Down
3 changes: 0 additions & 3 deletions widget/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ pub use helpers::*;
#[cfg(feature = "lazy")]
mod lazy;

#[cfg(feature = "lazy")]
pub use crate::lazy::{Component, Lazy, Responsive};

#[cfg(feature = "lazy")]
pub use crate::lazy::helpers::*;

Expand Down
Loading