Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
44 lines (34 loc) · 1.18 KB

File metadata and controls

44 lines (34 loc) · 1.18 KB
Copy raw file
Download raw file
Edit and raw actions

Rule

The Rule widget is a horizontal (or vertical) line for separating widgets clearly. It has two methods of construction: the horizontal_rule function and the Rule::horizontal constructor. For the vertical rule, we can use the vertical_rule function or the Rule::vertical constructor. We can change the space around it,

use iced::widget::{Rule, column, horizontal_rule, text, vertical_rule};

fn main() -> iced::Result {
    iced::run("My App", MyApp::update, MyApp::view)
}

#[derive(Debug, Clone)]
enum Message {}

#[derive(Default)]
struct MyApp;

impl MyApp {
    fn update(&mut self, _message: Message) {}

    fn view(&self) -> iced::Element<Message> {
        column![
            text("Construct from struct"),
            Rule::horizontal(0),
            text("Construct from function"),
            horizontal_rule(0),
            text("Different space"),
            horizontal_rule(50),
            text("Vertical rule"),
            vertical_rule(100),
        ]
        .into()
    }
}

Rule

➡️ Next: Image

📘 Back: Table of contents

Morty Proxy This is a proxified and sanitized view of the page, visit original site.