File tree 7 files changed +20
-16
lines changed
7 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " simple-generated"
3
3
version = " 0.1.0"
4
- authors = [
" Josh McKinney <[email protected] .com>" ]
4
+ authors = [" Orhun Parmaksız <orhunparmaksiz@gmail .com>" ]
5
5
license = " MIT"
6
6
edition = " 2021"
7
7
Original file line number Diff line number Diff line change 1
1
The MIT License (MIT)
2
2
3
- Copyright (c)
Josh McKinney <[email protected] .com>
3
+ Copyright (c) Orhun Parmaksız <orhunparmaksiz@gmail .com>
4
4
5
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change 1
1
# simple-generated
2
2
3
- This is a [ Ratatui] app generated by the [ Simple template ] .
3
+ This is a [ Ratatui] app generated by the [ Simple Template ] .
4
4
5
5
[ Ratatui ] : https://ratatui.rs
6
6
[ Simple Template ] : https://github.com/ratatui/templates/tree/main/simple
7
7
8
8
## License
9
9
10
- Copyright (c)
Josh McKinney < [email protected] .com>
10
+ Copyright (c) Orhun Parmaksız < orhunparmaksiz@gmail .com>
11
11
12
12
This project is licensed under the MIT license ([ LICENSE] or < http://opensource.org/licenses/MIT > )
13
13
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use ratatui::{
7
7
DefaultTerminal , Frame ,
8
8
} ;
9
9
10
+ /// The main application which holds the state and logic of the application.
10
11
#[ derive( Debug , Default ) ]
11
12
pub struct App {
12
13
/// Is the application running?
@@ -23,7 +24,7 @@ impl App {
23
24
pub fn run ( mut self , mut terminal : DefaultTerminal ) -> Result < ( ) > {
24
25
self . running = true ;
25
26
while self . running {
26
- terminal. draw ( |frame| self . draw ( frame) ) ?;
27
+ terminal. draw ( |frame| self . render ( frame) ) ?;
27
28
self . handle_crossterm_events ( ) ?;
28
29
}
29
30
Ok ( ( ) )
@@ -32,9 +33,10 @@ impl App {
32
33
/// Renders the user interface.
33
34
///
34
35
/// This is where you add new widgets. See the following resources for more information:
36
+ ///
35
37
/// - <https://docs.rs/ratatui/latest/ratatui/widgets/index.html>
36
- /// - <https://github.com/ratatui/ratatui/tree/master /examples>
37
- fn draw ( & mut self , frame : & mut Frame ) {
38
+ /// - <https://github.com/ratatui/ratatui/tree/main/ratatui-widgets /examples>
39
+ fn render ( & mut self , frame : & mut Frame ) {
38
40
let title = Line :: from ( "Ratatui Simple Template" )
39
41
. bold ( )
40
42
. blue ( )
Original file line number Diff line number Diff line change 1
- # Ratatui Simple template
1
+ # Ratatui Simple Template
2
2
3
3
The simple template will create the following project structure:
4
4
5
5
``` text
6
6
src/
7
7
├── app.rs -> holds the state and application logic
8
- ├ ── main.rs -> entry-point
8
+ └ ── main.rs -> entry-point
9
9
```
10
10
11
11
## Design choices
12
12
13
13
We have a small ` App ` struct that has a main loop that calls methods to handle events and draw the
14
- ui . The app can be quit by pressing any of Q/Esc/Ctrl+C.
14
+ UI . The app can be quit by pressing any of Q/Esc/Ctrl+C.
15
15
16
- We use [ color-eyre] ( https://docs.rs/color-eyre/latest/color_eyre/ ) for simplifying any errors that
17
- need to be reported to the console.
16
+ We use [ color-eyre] ( https://docs.rs/color-eyre ) for simplifying any errors that need to be reported
17
+ to the console.
Original file line number Diff line number Diff line change 1
1
# {{project-name}}
2
2
3
- This is a [ Ratatui] app generated by the [ Simple template ] .
3
+ This is a [ Ratatui] app generated by the [ Simple Template ] .
4
4
5
5
[ Ratatui ] : https://ratatui.rs
6
6
[ Simple Template ] : https://github.com/ratatui/templates/tree/main/simple
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use ratatui::{
7
7
DefaultTerminal , Frame ,
8
8
} ;
9
9
10
+ /// The main application which holds the state and logic of the application.
10
11
#[ derive( Debug , Default ) ]
11
12
pub struct App {
12
13
/// Is the application running?
@@ -23,7 +24,7 @@ impl App {
23
24
pub fn run ( mut self , mut terminal : DefaultTerminal ) -> Result < ( ) > {
24
25
self . running = true ;
25
26
while self . running {
26
- terminal. draw ( |frame| self . draw ( frame) ) ?;
27
+ terminal. draw ( |frame| self . render ( frame) ) ?;
27
28
self . handle_crossterm_events ( ) ?;
28
29
}
29
30
Ok ( ( ) )
@@ -32,9 +33,10 @@ impl App {
32
33
/// Renders the user interface.
33
34
///
34
35
/// This is where you add new widgets. See the following resources for more information:
36
+ ///
35
37
/// - <https://docs.rs/ratatui/latest/ratatui/widgets/index.html>
36
- /// - <https://github.com/ratatui/ratatui/tree/master /examples>
37
- fn draw ( & mut self , frame : & mut Frame ) {
38
+ /// - <https://github.com/ratatui/ratatui/tree/main/ratatui-widgets /examples>
39
+ fn render ( & mut self , frame : & mut Frame ) {
38
40
let title = Line :: from ( "Ratatui Simple Template" )
39
41
. bold ( )
40
42
. blue ( )
You can’t perform that action at this time.
0 commit comments