pub struct App { /* private fields */ }
Expand description
The powerhouse of tui-helper, runs all defined widgets for you at a set framerate
Create a new app with the given clock time (in ms)
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?.with_widget(widget).run()
}
More examples
Hide additional examples
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_generator)
.with_widget(render)
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.with_state(CustomState { state: 0 })
.with_widget(handle_state)
.handle_panics()
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_builder)
.with_widget(my_widget)
.with_set(Message)
.run()
}
Running this will ensure that any panic that happens, this will catch
And prevent your terminal from messing up.
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_generator)
.with_widget(render)
.run()
}
More examples
Hide additional examples
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.with_state(CustomState { state: 0 })
.with_widget(handle_state)
.handle_panics()
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_builder)
.with_widget(my_widget)
.with_set(Message)
.run()
}
Add a widget to the system
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?.with_widget(widget).run()
}
More examples
Hide additional examples
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_generator)
.with_widget(render)
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.with_state(CustomState { state: 0 })
.with_widget(handle_state)
.handle_panics()
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_builder)
.with_widget(my_widget)
.with_set(Message)
.run()
}
Add a state to the system
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.with_state(CustomState { state: 0 })
.with_widget(handle_state)
.handle_panics()
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_builder)
.with_widget(my_widget)
.with_set(Message)
.run()
}
Run the app, returning an error if any of the functions error out.
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?.with_widget(widget).run()
}
More examples
Hide additional examples
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_generator)
.with_widget(render)
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.with_state(CustomState { state: 0 })
.with_widget(handle_state)
.handle_panics()
.run()
}
fn main() -> Result<(), Box<dyn Error>> {
App::new(100)?
.handle_panics()
.with_widget(chunk_builder)
.with_widget(my_widget)
.with_set(Message)
.run()
}
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.