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
//! Different components for rendering a collection of things.
//!
//! There are many ways to render a list of items with Async UI Web.
//!
//! ### Basic `join`/`race`
//! The [join][crate::join] and [race][crate::race] functions support array or
//! [Vec] of futures as input. They display the futures side by side, in order.
//!
//! ```
//! # use async_ui_web::{join, prelude_traits::*};
//! # let _ = async {
//! join(
//! (1..20)
//! .map(|num| num.to_string().render())
//! .collect::<Vec<_>>()
//! ).await;
//! # };
//! ```
//!
//! This is the most basic way to render a list of things. You don't need any
//! list component to do this.
//!
//! This approach is not very flexible: there is no way to insert into or remove
//! from the vec once you've passed it to `join`.
//!
//! ### DiffedList
//! [DiffedList] is more flexible. You provide it with a Vec of "keys", and
//! a closure to convert each key into a future. You can update the keys Vec
//! and the list will automatically make sure the right futures are rendered.
//!
//! DiffedList is not great for performance when the list is long.
//! In those case, prefer ModeledList...
//!
//! ### ModeledList
//! [ModeledList] is very similar to [DiffedList], but significantly more
//! performant. The tradeoff is you no longer work with a plain Vec of keys,
//! but rather a [ListModel]. ListModel is more restrictive than Vec on what
//! modification you can make, but common operations (insert/remove/swap/...)
//! are all available.
//!
//! **If you don't know what list component to use, use ModeledList**.
//!
//! ### DynamicList
//! [DynamicList] is the base component on which every other list builds on.
//! It provides fine control, but is harder to use. It's API is very imperative;
//! with DiffedList and ModeledList you update the "keys" and the UI
//! automatically gets updated, with DynamicList you have to deal with
//! inserting/moving/removing futures manually.
//!
//! ### VirtualizedList
//! [VirtualizedList] is very different from all the other lists. It is made
//! for very large collections. It only renders the items that are visible in
//! the viewport to save resource.
//!
//! The implementation still needs some work. Right now, the list only supports
//! fixed-height items.
pub use DiffedList;
pub use DynamicList;
pub use ;
pub use VirtualizedList;