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
106
107
108
109
110
// Copyright 2024 the Xilem Authors
// SPDX-License-Identifier: Apache-2.0
//! The types which can be used as elements in a [`View`](crate::View)
/// A type which can be used as the `Element` associated type for a [`View`](crate::View).
///
/// It is expected that most libraries using `xilem_core` will have a generic
/// implementation of this trait for their widget type.
/// Additionally, this may also be implemented for other types, depending on the
/// needs of the specific parent view.
/// In Xilem (the user interface library), this is also used for types containing the
/// flex properties of their child views, and window properties.
///
/// In most cases, there will be a corresponding implementation of [`SuperElement<Self>`] for
/// some other type.
/// This will be the generic form of this type, which is used for the implementation of [`AnyView`].
///
/// [`AnyView`]: crate::AnyView
///
// TODO: Rename so that it doesn't conflict with the type parameter names
/// This alias is syntax sugar to avoid the elaborate expansion of
/// `<Self::Element as ViewElement>::Mut<'el>` in the View trait when implementing it (e.g. via rust-analyzer)
pub type Mut<'el, E> = Mut;
/// This element type is a superset of `Child`.
///
/// There are two primary use cases for this type:
/// 1) The dynamic form of the element type, used for [`AnyView`] and [`ViewSequence`]s.
/// 2) Additional, optional, information which can be added to an element type.
/// This will primarily be used in [`ViewSequence`] implementations.
///
/// [`AnyView`]: crate::AnyView
/// [`ViewSequence`]: crate::ViewSequence
/// An element which can be used for an [`AnyView`](crate::AnyView) containing `Child`.
/// Element type for views which don't impact the element tree.
///
/// Views with this element type can be included in any [`ViewSequence`](crate::ViewSequence) (with the
/// correct `State` and `Action` types), as they do not need to actually add an element to the sequence.
///
/// These views can also as the `alongside_view` in [`fork`](crate::fork).
;