src/mapping.rs

branch
dev
changeset 39
dd144a972722
parent 36
6a4b44b2cdf2
child 42
b4d369698556
equal deleted inserted replaced
38:8aaa22fcd302 39:dd144a972722
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>,

mercurial