summaryrefslogtreecommitdiffstats
path: root/core/src/widget.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-05 17:46:33 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-10 10:01:49 +0100
commitd278bfd21d0399009e652560afb9a4d185e92637 (patch)
tree7ae77df9ff80f1ccd82935c2d442633ff6b96789 /core/src/widget.rs
parent22226394f7b1a0e0205b9bb5b3ef9b85a3b406f5 (diff)
downloadiced-d278bfd21d0399009e652560afb9a4d185e92637.tar.gz
iced-d278bfd21d0399009e652560afb9a4d185e92637.tar.bz2
iced-d278bfd21d0399009e652560afb9a4d185e92637.zip
Replace `width` and `height` with `Widget::size`
Diffstat (limited to 'core/src/widget.rs')
-rw-r--r--core/src/widget.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/core/src/widget.rs b/core/src/widget.rs
index 890b3773..7f5632ae 100644
--- a/core/src/widget.rs
+++ b/core/src/widget.rs
@@ -43,18 +43,15 @@ pub trait Widget<Message, Renderer>
where
Renderer: crate::Renderer,
{
- /// Returns the width of the [`Widget`].
- fn width(&self) -> Length;
-
- /// Returns the height of the [`Widget`].
- fn height(&self) -> Length;
+ /// Returns the [`Size`] of the [`Widget`] in lengths.
+ fn size(&self) -> Size<Length>;
/// Returns a [`Size`] hint for laying out the [`Widget`].
///
/// This hint may be used by some widget containers to adjust their sizing strategy
/// during construction.
fn size_hint(&self) -> Size<Length> {
- Size::new(self.width(), self.height())
+ self.size()
}
/// Returns the [`layout::Node`] of the [`Widget`].