Implement pure version of Rule widget

This commit is contained in:
Héctor Ramón Jiménez 2022-03-10 16:58:55 +07:00
parent 31d814b43c
commit 0fbd1d98b5
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
3 changed files with 116 additions and 6 deletions

View file

@ -15,20 +15,20 @@ pub struct Rule<'a> {
}
impl<'a> Rule<'a> {
/// Creates a horizontal [`Rule`] for dividing content by the given vertical spacing.
pub fn horizontal(spacing: u16) -> Self {
/// Creates a horizontal [`Rule`] with the given height.
pub fn horizontal(height: u16) -> Self {
Rule {
width: Length::Fill,
height: Length::from(Length::Units(spacing)),
height: Length::Units(height),
is_horizontal: true,
style_sheet: Default::default(),
}
}
/// Creates a vertical [`Rule`] for dividing content by the given horizontal spacing.
pub fn vertical(spacing: u16) -> Self {
/// Creates a vertical [`Rule`] with the given width.
pub fn vertical(width: u16) -> Self {
Rule {
width: Length::from(Length::Units(spacing)),
width: Length::from(Length::Units(width)),
height: Length::Fill,
is_horizontal: false,
style_sheet: Default::default(),