Expand description
Late values: a cell for a value that arrives after asynchronous work
(a volume’s free space, a folder’s size, a count from a database),
in four states (Late):
Experimental: may change in any release
(docs/stability.md).
- pending: a
Skeletonline, or a delayedSpinner(Waiting::Spinner), in a box sized like the expected value (LateValue::sample,LateValue::size), so nothing moves when the value lands; - fresh: the value, as text in a
TextRoleor drawn by a closure (LateValue::show_with); - refreshing: the last value, a small spinner beside it;
- failed: an error icon, the reason and a Retry button;
LateResponse::retrysays it was clicked (the application runs the work again).
The cell keeps the spinner’s room in every state, so its size is the
same pending, fresh and refreshing. Its accessible node (a status) keeps
the value’s name; its value says the state (the value, “Loading”, the
error) and it is busy while the work runs.
use egui_pop_core::late::{Late, LateValue};
fn ui(ui: &mut egui::Ui, free: &Late<String>) {
let cell = LateValue::new("Free space", free.clone())
.sample("000.0 GB")
.show(ui);
if cell.retry {
// Run the work again.
}
}Structs§
- Late
Response - What
LateValue::showreturns. - Late
Value - A cell showing a value that arrives late, in its four states.