summaryrefslogtreecommitdiffstats
path: root/web/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-30 21:32:21 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-30 21:33:27 +0100
commit3a327e08e96d9588d145c32afe4f04f37a8f0f0f (patch)
treeb1da004410c0dc4ba82bd0c3262ea3359fad38b2 /web/src/widget
parent8426bf953cb50f3b7fcb1e0ec8c2fdf22d2b01af (diff)
downloadiced-3a327e08e96d9588d145c32afe4f04f37a8f0f0f.tar.gz
iced-3a327e08e96d9588d145c32afe4f04f37a8f0f0f.tar.bz2
iced-3a327e08e96d9588d145c32afe4f04f37a8f0f0f.zip
Rename `Empty` widget to `Space`
Diffstat (limited to 'web/src/widget')
-rw-r--r--web/src/widget/space.rs (renamed from web/src/widget/empty.rs)49
1 files changed, 24 insertions, 25 deletions
diff --git a/web/src/widget/empty.rs b/web/src/widget/space.rs
index dda17efe..baf4c80b 100644
--- a/web/src/widget/empty.rs
+++ b/web/src/widget/space.rs
@@ -4,43 +4,42 @@ use dodrio::bumpalo;
/// An amount of empty space.
///
/// It can be useful if you want to fill some space with nothing.
-///
-/// [`Empty`]: struct.Empty.html
#[derive(Debug)]
-pub struct Empty {
+pub struct Space {
width: Length,
height: Length,
}
-impl Empty {
- /// Creates an amount of [`Empty`] space.
+impl Space {
+ /// Creates an amount of empty [`Space`] with the given width and height.
///
- /// [`Empty`]: struct.Empty.html
- pub fn new() -> Self {
- Empty {
- width: Length::Shrink,
- height: Length::Shrink,
- }
+ /// [`Space`]: struct.Space.html
+ pub fn new(width: Length, height: Length) -> Self {
+ Space { width, height }
}
- /// Sets the width of the [`Empty`] space.
+ /// Creates an amount of horizontal [`Space`].
///
- /// [`Empty`]: struct..html
- pub fn width(mut self, width: Length) -> Self {
- self.width = width;
- self
+ /// [`Space`]: struct.Space.html
+ pub fn with_width(width: Length) -> Self {
+ Space {
+ width,
+ height: Length::Shrink,
+ }
}
- /// Sets the height of the [`Empty`] space.
+ /// Creates an amount of vertical [`Space`].
///
- /// [`Empty`]: struct.Column.html
- pub fn height(mut self, height: Length) -> Self {
- self.height = height;
- self
+ /// [`Space`]: struct.Space.html
+ pub fn with_height(height: Length) -> Self {
+ Space {
+ width: Length::Shrink,
+ height,
+ }
}
}
-impl<'a, Message> Widget<Message> for Empty {
+impl<'a, Message> Widget<Message> for Space {
fn node<'b>(
&self,
bump: &'b bumpalo::Bump,
@@ -63,8 +62,8 @@ impl<'a, Message> Widget<Message> for Empty {
}
}
-impl<'a, Message> From<Empty> for Element<'a, Message> {
- fn from(empty: Empty) -> Element<'a, Message> {
- Element::new(empty)
+impl<'a, Message> From<Space> for Element<'a, Message> {
+ fn from(space: Space) -> Element<'a, Message> {
+ Element::new(space)
}
}