Rename Empty widget to Space

This commit is contained in:
Héctor Ramón Jiménez 2019-12-30 21:32:21 +01:00
parent 8426bf953c
commit 3a327e08e9
8 changed files with 69 additions and 69 deletions

View file

@ -25,10 +25,10 @@ pub mod text_input;
mod checkbox;
mod column;
mod container;
mod empty;
mod image;
mod radio;
mod row;
mod space;
mod text;
#[doc(no_inline)]
@ -45,10 +45,10 @@ pub use text_input::TextInput;
pub use checkbox::Checkbox;
pub use column::Column;
pub use container::Container;
pub use empty::Empty;
pub use image::Image;
pub use radio::Radio;
pub use row::Row;
pub use space::Space;
/// A component that displays information and allows interaction.
///

View file

@ -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,
/// [`Space`]: struct.Space.html
pub fn new(width: Length, height: Length) -> Self {
Space { width, height }
}
/// Creates an amount of horizontal [`Space`].
///
/// [`Space`]: struct.Space.html
pub fn with_width(width: Length) -> Self {
Space {
width,
height: Length::Shrink,
}
}
/// Sets the width of the [`Empty`] space.
/// Creates an amount of vertical [`Space`].
///
/// [`Empty`]: struct..html
pub fn width(mut self, width: Length) -> Self {
self.width = width;
self
}
/// Sets the height of the [`Empty`] 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)
}
}