1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! Trait surface exposed by anything renderable in a [`Group`](crate::future::Group) or
//! [`stream::Group`](crate::stream::Group).
//!
//! A [`Group`](crate::future::Group) owns and polls its work. After each poll it reads the work's
//! current state through [`Progressive`] and renders one terminal line per item. Default
//! implementations return "nothing to render" so an adapter only spells out the fields it actually
//! tracks: a future-with-spinner returns no values from any method, a byte-tracking stream returns
//! cumulative bytes and an optional total, etc.
//!
//! Built-in adapters ([`ProgressFuture`](crate::future::ProgressFuture),
//! [`ProgressStream`](crate::stream::ProgressStream),
//! [`ProgressBytesStream`](crate::stream::ProgressBytesStream)) already implement [`Progressive`];
//! user types can implement it directly to push custom work into a Group.
//!
//! The lifetime parameter `'a` ties any per-row [`Theme`] override to the same lifetime the
//! adapter's other borrowed data lives for. Implementations that don't supply a theme override
//! can use `impl<'a> Progressive<'a> for MyType` regardless of `'a`.
use Future;
use Stream;
use Style;
use crateTheme;
/// Read-only view of an item's current progress state.
///
/// Methods return "nothing to render" by default. Adapters override only the fields they track.
/// Callers (Groups, standalone wrappers) read these on every frame and forward to the layout.
/// A [`Future`] that also reports progress via [`Progressive`].
///
/// Blanket-implemented for any `T: Future + Progressive<'a>`. This is the trait object stored by
/// [`future::Group`](crate::future::Group).
/// A [`Stream`] that also reports progress via [`Progressive`].
///
/// Blanket-implemented for any `T: Stream + Progressive<'a>`. This is the trait object stored by
/// [`stream::Group`](crate::stream::Group).