A loading-screen wrapper for
gyscos/cursive
views
This project is work-in-progress
This project provides a wrapper view with a loading screen for gyscos/cursive views. The loading screen will disappear once the wrapped view is fully loaded. This is useful for displaying views which may take long to construct or depend on e.g. the network.
demo
Expand to view
Simply add to your Cargo.toml
toml
[dependencies]
cursive-async-view = "^0"
If you can't tell the progress during a long taking creation of a view, you may
wrap the creation of this view in an AsyncView
. This will display a loading
animation until the inner view is ready to be drawn.
```rust use cursive::{views::TextView, Cursive}; use cursiveasyncview::AsyncView;
let mut siv = Cursive::default(); let asyncview = AsyncView::new(&siv, move || { std::thread::sleep(std::time::Duration::fromsecs(10)); TextView::new("Yay!\n\nThe content has loaded!") });
siv.addlayer(asyncview); siv.run(); ```
If you have information about the progress a long taking view creation has made,
you can wrap the creation in an AsyncProgressView
. This will display a progress
bar until the inner view is ready to be drawn.
```rust use crossbeam::Sender; use cursive::{views::TextView, Cursive}; use cursiveasyncview::AsyncProgressView;
let mut siv = Cursive::default();
let asyncview = AsyncProgressView::new(&siv, |s: Sender
siv.addlayer(asyncview); siv.run(); ```
If you find any bugs/unexpected behaviour or you have a proposition for future changes open an issue describing the current behaviour and what you expected.
TBD
Just run
$ cargo test
to execute all available tests.
shields.io endpoints are generated inside the ./target/shields
folder. They are used in this README.
Fin Christensen
:octocat:
@fin-ger
:elephant:@fin_ger@mastodon.social
:bird:@fin_ger_github
Johannes Wünsche
:octocat:
@jwuensche
:elephant:@fredowald@mastodon.social
:bird:@Fredowald
Give a :star: if this project helped you!