| 108 impl<Domain, M : Mapping<Domain>> Sum<Domain, M> { |
108 impl<Domain, M : Mapping<Domain>> Sum<Domain, M> { |
| 109 /// Construct from an iterator. |
109 /// Construct from an iterator. |
| 110 pub fn new<I : Iterator<Item = M>>(iter : I) -> Self { |
110 pub fn new<I : Iterator<Item = M>>(iter : I) -> Self { |
| 111 Sum { components : iter.collect(), _domain : PhantomData } |
111 Sum { components : iter.collect(), _domain : PhantomData } |
| 112 } |
112 } |
| |
113 |
| |
114 /// Iterate over the component functions of the sum |
| |
115 pub fn iter(&self) -> std::slice::Iter<'_, M> { |
| |
116 self.components.iter() |
| |
117 } |
| 113 } |
118 } |
| 114 |
119 |
| 115 |
120 |
| 116 impl<Domain : Copy, M> Apply<Domain> for Sum<Domain, M> |
121 impl<Domain : Copy, M> Apply<Domain> for Sum<Domain, M> |
| 117 where M : Mapping<Domain>, |
122 where M : Mapping<Domain>, |