Function cursive_extras::load_resource
source · pub fn load_resource<T, R, F, D, M>(
root: &mut Cursive,
title: D,
msg: M,
task: R,
finish_task: F
)where
D: Display,
T: Send + Sync + 'static,
R: FnOnce() -> T + Send + Sync + 'static,
M: Into<StyledString>,
F: FnOnce(&mut Cursive, T) + Send + Sync + 'static,
Expand description
Convenience function that shows a loading pop up
Example
let mut root = cursive::default();
root.set_theme(better_theme());
load_resource(&mut root,
"Loading...", "Loading Dummy Number...",
|| {
thread::sleep(Duration::from_secs(5));
2 + 4
},
|root, val| {
assert_eq!(val, 6);
root.quit()
}
);
root.run();