Skip to content

Commit

Permalink
docs: Improve README examples 📚
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak committed Jan 9, 2024
1 parent 76d1e5b commit 57a0a34
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,19 @@ use ratatui_macros::{vertical, horizontal};

let area = Rect { x: 0, y: 0, width: 10, height: 10 };

let vertical_layout = vertical![==100%, >=3];
let [main, bottom] = vertical_layout.split(area).to_vec().try_into().unwrap();
let [main, bottom] = vertical![==100%, >=3]
.split(area)
.to_vec()
.try_into()
.unwrap();
assert_eq!(bottom.height, 3);

let horizontal_layout = horizontal![==100%, >=3];
let [main, right] = horizontal_layout.split(area).to_vec().try_into().unwrap();
let [left, main, right] = horizontal![>=3, ==100%, >=3]
.split(area)
.to_vec()
.try_into()
.unwrap();
assert_eq!(left.width, 3);
assert_eq!(right.width, 3);
```

Expand Down

0 comments on commit 57a0a34

Please sign in to comment.