Skip to content

Commit ad87c16

Browse files
committed
ZipMap takes two args, rename frame Fout to F
1 parent 6d31b7a commit ad87c16

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/signal.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -523,19 +523,19 @@ pub struct GenMut<G, F> {
523523

524524
/// A signal that maps from one signal to another
525525
#[derive(Clone)]
526-
pub struct Map<M, S, Fout> {
526+
pub struct Map<M, S, F> {
527527
map: M,
528528
signal: S,
529-
frames: core::marker::PhantomData<Fout>,
529+
frames: core::marker::PhantomData<F>,
530530
}
531531

532532
/// A signal that iterates two signals in parallel and combines them with a function
533533
#[derive(Clone)]
534-
pub struct ZipMap<M, S, O, Fout> {
534+
pub struct ZipMap<M, S, O, F> {
535535
map: M,
536536
this: S,
537537
other: O,
538-
frame: core::marker::PhantomData<Fout>
538+
frame: core::marker::PhantomData<F>
539539
}
540540

541541
/// A type that wraps an Iterator and provides a `Signal` implementation for it.
@@ -856,10 +856,10 @@ pub fn gen_mut<G, F>(gen_mut: G) -> GenMut<G, F>
856856
/// assert_eq!(mapper.next(), [0.5, 0.25]);
857857
/// }
858858
/// ```
859-
pub fn map<M, S, Fout>(signal: S, map: M) -> Map<M, S, Fout>
860-
where M: FnMut(<S as Signal>::Frame) -> Fout,
859+
pub fn map<M, S, F>(signal: S, map: M) -> Map<M, S, F>
860+
where M: FnMut(S::Frame) -> F,
861861
S: Signal,
862-
Fout: Frame,
862+
F: Frame,
863863
{
864864
Map {
865865
map: map,
@@ -881,17 +881,17 @@ pub fn map<M, S, Fout>(signal: S, map: M) -> Map<M, S, Fout>
881881
/// fn main() {
882882
/// let frames = signal::gen(|| [0.5]);
883883
/// let more_frames = signal::gen(|| [0.25]);
884-
/// let mut mapper = signal::zip_map(frames, more_frames, |(f, o)| [f[0], o[0]]);
884+
/// let mut mapper = signal::zip_map(frames, more_frames, |f, o| [f[0], o[0]]);
885885
/// assert_eq!(mapper.next(), [0.5, 0.25]);
886886
/// assert_eq!(mapper.next(), [0.5, 0.25]);
887887
/// assert_eq!(mapper.next(), [0.5, 0.25]);
888888
/// }
889889
/// ```
890-
pub fn zip_map<M, S, O, Fout>(this: S, other: O, map: M) -> ZipMap<M, S, O, Fout>
891-
where M: FnMut((<S as Signal>::Frame, <O as Signal>::Frame)) -> Fout,
890+
pub fn zip_map<M, S, O, F>(this: S, other: O, map: M) -> ZipMap<M, S, O, F>
891+
where M: FnMut(S::Frame, O::Frame) -> F,
892892
S: Signal,
893893
O: Signal,
894-
Fout: Frame,
894+
F: Frame,
895895
{
896896
ZipMap {
897897
map: map,
@@ -1186,29 +1186,29 @@ impl<G, F> Signal for GenMut<G, F>
11861186
}
11871187

11881188

1189-
impl<M, S, Fout> Signal for Map<M, S, Fout>
1190-
where M: FnMut(<S as Signal>::Frame) -> Fout,
1189+
impl<M, S, F> Signal for Map<M, S, F>
1190+
where M: FnMut(S::Frame) -> F,
11911191
S: Signal,
1192-
Fout: Frame,
1192+
F: Frame,
11931193
{
1194-
type Frame = Fout;
1194+
type Frame = F;
11951195
#[inline]
11961196
fn next(&mut self) -> Self::Frame {
11971197
(self.map)(self.signal.next())
11981198
}
11991199
}
12001200

12011201

1202-
impl<M, S, O, Fout> Signal for ZipMap<M, S, O, Fout>
1203-
where M: FnMut((<S as Signal>::Frame, <O as Signal>::Frame)) -> Fout,
1202+
impl<M, S, O, F> Signal for ZipMap<M, S, O, F>
1203+
where M: FnMut(S::Frame, O::Frame) -> F,
12041204
S: Signal,
12051205
O: Signal,
1206-
Fout: Frame,
1206+
F: Frame,
12071207
{
1208-
type Frame = Fout;
1208+
type Frame = F;
12091209
#[inline]
12101210
fn next(&mut self) -> Self::Frame {
1211-
(self.map)((self.this.next(), self.other.next()))
1211+
(self.map)(self.this.next(), self.other.next())
12121212
}
12131213
}
12141214

0 commit comments

Comments
 (0)